Buggy code:
public abstract class WebSocketServerHandshaker { protected static final InternalLogger logger = InternalLoggerFactory . getInstance ( WebSocketServerHandshaker . class ) ; private static final ClosedChannelException CLOSED_CHANNEL_EXCEPTION = new ClosedChannelException ( ) ; private final String uri ; private final String [ ] subprotocols ; private final WebSocketVersion version ; private final int maxFramePayloadLength ; private String selectedSubprotocol ; public static final String SUB_PROTOCOL_WILDCARD = "*" ; protected WebSocketServerHandshaker ( WebSocketVersion version , String uri , String subprotocols , int maxFramePayloadLength ) { } public String uri ( ) { } public Set < String > subprotocols ( ) { } public WebSocketVersion version ( ) { } public int maxFramePayloadLength ( ) { } public ChannelFuture handshake ( Channel channel , FullHttpRequest req ) { } public final ChannelFuture handshake ( Channel channel , FullHttpRequest req , HttpHeaders responseHeaders , final ChannelPromise promise ) { } public ChannelFuture handshake ( Channel channel , HttpRequest req ) { } public final ChannelFuture handshake ( final Channel channel , HttpRequest req , final HttpHeaders responseHeaders , final ChannelPromise promise ) { if ( req instanceof FullHttpRequest ) { return handshake ( channel , ( ( FullHttpRequest ) ( req ) ) , responseHeaders , promise ) ; } if ( WebSocketServerHandshaker . logger . isDebugEnabled ( ) ) { WebSocketServerHandshaker . logger . debug ( "{}<seq2seq4repair_space>WebSocket<seq2seq4repair_space>version<seq2seq4repair_space>{}<seq2seq4repair_space>server<seq2seq4repair_space>handshake" , channel , version ( ) ) ; } ChannelPipeline p = channel . pipeline ( ) ; ChannelHandlerContext ctx = p . context ( HttpRequestDecoder . class ) ; if ( ctx == null ) { ctx = p . context ( HttpServerCodec . class ) ; if ( ctx == null ) { promise . setFailure ( new IllegalStateException ( "No<seq2seq4repair_space>HttpDecoder<seq2seq4repair_space>and<seq2seq4repair_space>no<seq2seq4repair_space>HttpServerCodec<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>pipeline" ) ) ; return promise ; } } String aggregatorName = "httpAggregator" ; p . addAfter ( ctx . name ( ) , aggregatorName , new HttpObjectAggregator ( 8192 ) ) ; p . addAfter ( aggregatorName , "handshaker" , new io . netty . channel . SimpleChannelInboundHandler < FullHttpRequest > ( ) { @ Override <START_BUG> protected void channelRead0 ( ChannelHandlerContext ctx , FullHttpRequest msg ) throws Exception { <END_BUG> ctx . pipeline ( ) . remove ( this ) ; handshake ( channel , msg , responseHeaders , promise ) ; } @ Override public void exceptionCaught ( ChannelHandlerContext ctx , Throwable cause ) throws Exception { ctx . pipeline ( ) . remove ( this ) ; promise . tryFailure ( cause ) ; ctx . fireExceptionCaught ( cause ) ; } @ Override public void channelInactive ( ChannelHandlerContext ctx ) throws Exception { promise . tryFailure ( WebSocketServerHandshaker . CLOSED_CHANNEL_EXCEPTION ) ; ctx . fireChannelInactive ( ) ; } } ) ; try { ctx . fireChannelRead ( ReferenceCountUtil . retain ( req ) ) ; } catch ( Throwable cause ) { promise . setFailure ( cause ) ; } return promise ; } protected abstract FullHttpResponse newHandshakeResponse ( FullHttpRequest req , HttpHeaders responseHeaders ) { } public ChannelFuture close ( Channel channel , CloseWebSocketFrame frame ) { } public ChannelFuture close ( Channel channel , CloseWebSocketFrame frame , ChannelPromise promise ) { } protected String selectSubprotocol ( String requestedSubprotocols ) { } public String selectedSubprotocol ( ) { } protected abstract WebSocketFrameDecoder newWebsocketDecoder ( ) { } protected abstract WebSocketFrameEncoder newWebSocketEncoder ( ) { } }

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