Buggy code:
public class HttpObjectAggregator extends MessageAggregator < HttpObject , HttpMessage , HttpContent , FullHttpMessage > { private static final InternalLogger logger = InternalLoggerFactory . getInstance ( HttpObjectAggregator . class ) ; private static final FullHttpResponse CONTINUE = new DefaultFullHttpResponse ( HttpVersion . HTTP_1_1 , HttpResponseStatus . CONTINUE , Unpooled . EMPTY_BUFFER ) ; private static final FullHttpResponse TOO_LARGE = new DefaultFullHttpResponse ( HttpVersion . HTTP_1_1 , HttpResponseStatus . REQUEST_ENTITY_TOO_LARGE , Unpooled . EMPTY_BUFFER ) ; public HttpObjectAggregator ( int maxContentLength ) { } @ Override protected boolean isStartMessage ( HttpObject msg ) throws Exception { } @ Override protected boolean isContentMessage ( HttpObject msg ) throws Exception { } @ Override protected boolean isLastContentMessage ( HttpContent msg ) throws Exception { } @ Override protected boolean isAggregated ( HttpObject msg ) throws Exception { } @ Override protected boolean hasContentLength ( HttpMessage start ) throws Exception { } @ Override protected long contentLength ( HttpMessage start ) throws Exception { } @ Override protected Object newContinueResponse ( HttpMessage start ) throws Exception { } @ Override protected FullHttpMessage beginAggregation ( HttpMessage start , ByteBuf content ) throws Exception { } @ Override protected void aggregate ( FullHttpMessage aggregated , HttpContent content ) throws Exception { } @ Override protected void finishAggregation ( FullHttpMessage aggregated ) throws Exception { } @ Override protected void handleOversizedMessage ( final ChannelHandlerContext ctx , HttpMessage oversized ) throws Exception { } private static abstract class AggregatedFullHttpMessage extends DefaultByteBufHolder implements FullHttpMessage { protected final HttpMessage message ; private HttpHeaders trailingHeaders ; AggregatedFullHttpMessage ( HttpMessage message , ByteBuf content , HttpHeaders trailingHeaders ) { } @ Override public HttpHeaders trailingHeaders ( ) { HttpHeaders trailingHeaders = this . trailingHeaders ; if ( trailingHeaders == null ) { <START_BUG> return HttpHeaders . EMPTY_HEADERS ; <END_BUG> } else { return trailingHeaders ; } } void setTrailingHeaders ( HttpHeaders trailingHeaders ) { } @ Override public HttpVersion protocolVersion ( ) { } @ Override public FullHttpMessage setProtocolVersion ( HttpVersion version ) { } @ Override public HttpHeaders headers ( ) { } @ Override public DecoderResult decoderResult ( ) { } @ Override public void setDecoderResult ( DecoderResult result ) { } @ Override public FullHttpMessage retain ( int increment ) { } @ Override public FullHttpMessage retain ( ) { } @ Override public FullHttpMessage touch ( Object hint ) { } @ Override public FullHttpMessage touch ( ) { } @ Override public abstract FullHttpMessage copy ( ) { } @ Override public abstract FullHttpMessage duplicate ( ) { } } private static final class AggregatedFullHttpRequest extends HttpObjectAggregator . AggregatedFullHttpMessage implements FullHttpRequest { AggregatedFullHttpRequest ( HttpRequest request , ByteBuf content , HttpHeaders trailingHeaders ) { } private FullHttpRequest copy ( boolean copyContent , ByteBuf newContent ) { } @ Override public FullHttpRequest copy ( ByteBuf newContent ) { } @ Override public FullHttpRequest copy ( ) { } @ Override public FullHttpRequest duplicate ( ) { } @ Override public FullHttpRequest retain ( int increment ) { } @ Override public FullHttpRequest retain ( ) { } @ Override public FullHttpRequest touch ( ) { } @ Override public FullHttpRequest touch ( Object hint ) { } @ Override public FullHttpRequest setMethod ( HttpMethod method ) { } @ Override public FullHttpRequest setUri ( String uri ) { } @ Override public HttpMethod method ( ) { } @ Override public String uri ( ) { } @ Override public FullHttpRequest setProtocolVersion ( HttpVersion version ) { } @ Override public String toString ( ) { } } private static final class AggregatedFullHttpResponse extends HttpObjectAggregator . AggregatedFullHttpMessage implements FullHttpResponse { AggregatedFullHttpResponse ( HttpResponse message , ByteBuf content , HttpHeaders trailingHeaders ) { } private FullHttpResponse copy ( boolean copyContent , ByteBuf newContent ) { } @ Override public FullHttpResponse copy ( ByteBuf newContent ) { } @ Override public FullHttpResponse copy ( ) { } @ Override public FullHttpResponse duplicate ( ) { } @ Override public FullHttpResponse setStatus ( HttpResponseStatus status ) { } @ Override public HttpResponseStatus status ( ) { } @ Override public FullHttpResponse setProtocolVersion ( HttpVersion version ) { } @ Override public FullHttpResponse retain ( int increment ) { } @ Override public FullHttpResponse retain ( ) { } @ Override public FullHttpResponse touch ( Object hint ) { } @ Override public FullHttpResponse touch ( ) { } @ Override public String toString ( ) { } } }

Fix:
return EmptyHttpHeaders . INSTANCE ;