Buggy code:
public abstract class WebSocketClientHandshaker { private static final ClosedChannelException CLOSED_CHANNEL_EXCEPTION = new ClosedChannelException ( ) ; private final URI uri ; private final WebSocketVersion version ; private volatile boolean handshakeComplete ; private final String expectedSubprotocol ; private volatile String actualSubprotocol ; protected final HttpHeaders customHeaders ; private final int maxFramePayloadLength ; protected WebSocketClientHandshaker ( URI uri , WebSocketVersion version , String subprotocol , HttpHeaders customHeaders , int maxFramePayloadLength ) { } public URI uri ( ) { } public WebSocketVersion version ( ) { } public int maxFramePayloadLength ( ) { } public boolean isHandshakeComplete ( ) { } private void setHandshakeComplete ( ) { } public String expectedSubprotocol ( ) { } public String actualSubprotocol ( ) { } private void setActualSubprotocol ( String actualSubprotocol ) { } public ChannelFuture handshake ( Channel channel ) { } public final ChannelFuture handshake ( Channel channel , final ChannelPromise promise ) { } protected abstract FullHttpRequest newHandshakeRequest ( ) { } public final void finishHandshake ( Channel channel , FullHttpResponse response ) { } public final ChannelFuture processHandshake ( final Channel channel , HttpResponse response ) { } public final ChannelFuture processHandshake ( final Channel channel , HttpResponse response , final ChannelPromise promise ) { if ( response instanceof FullHttpResponse ) { try { finishHandshake ( channel , ( ( FullHttpResponse ) ( response ) ) ) ; promise . setSuccess ( ) ; } catch ( Throwable cause ) { promise . setFailure ( cause ) ; } } else { ChannelPipeline p = channel . pipeline ( ) ; ChannelHandlerContext ctx = p . context ( HttpResponseDecoder . class ) ; if ( ctx == null ) { ctx = p . context ( HttpClientCodec . class ) ; if ( ctx == null ) { return promise . setFailure ( new IllegalStateException ( ( "ChannelPipeline<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>contain<seq2seq4repair_space>" + "a<seq2seq4repair_space>HttpResponseDecoder<seq2seq4repair_space>or<seq2seq4repair_space>HttpClientCodec" ) ) ) ; } } String aggregatorName = "httpAggregator" ; p . addAfter ( ctx . name ( ) , aggregatorName , new HttpObjectAggregator ( 8192 ) ) ; p . addAfter ( aggregatorName , "handshaker" , new io . netty . channel . SimpleChannelInboundHandler < FullHttpResponse > ( ) { @ Override <START_BUG> protected void channelRead0 ( ChannelHandlerContext ctx , FullHttpResponse msg ) throws Exception { <END_BUG> ctx . pipeline ( ) . remove ( this ) ; try { finishHandshake ( channel , msg ) ; promise . setSuccess ( ) ; } catch ( Throwable cause ) { promise . setFailure ( cause ) ; } } @ Override public void exceptionCaught ( ChannelHandlerContext ctx , Throwable cause ) throws Exception { ctx . pipeline ( ) . remove ( this ) ; promise . setFailure ( cause ) ; } @ Override public void channelInactive ( ChannelHandlerContext ctx ) throws Exception { promise . tryFailure ( WebSocketClientHandshaker . CLOSED_CHANNEL_EXCEPTION ) ; ctx . fireChannelInactive ( ) ; } } ) ; try { ctx . fireChannelRead ( ReferenceCountUtil . retain ( response ) ) ; } catch ( Throwable cause ) { promise . setFailure ( cause ) ; } } return promise ; } protected abstract void verify ( FullHttpResponse response ) { } protected abstract WebSocketFrameDecoder newWebsocketDecoder ( ) { } protected abstract WebSocketFrameEncoder newWebSocketEncoder ( ) { } public ChannelFuture close ( Channel channel , CloseWebSocketFrame frame ) { } public ChannelFuture close ( Channel channel , CloseWebSocketFrame frame , ChannelPromise promise ) { } }

Fix:
protected void messageReceived ( ChannelHandlerContext ctx , FullHttpResponse msg ) throws Exception {