Source:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws UnknownWebSocketFrameTypeException { cMsg = null; if (!(msg instanceof WebSocketFrame)) { LOGGER.error("Expecting WebSocketFrame. Unknown type."); throw new UnknownWebSocketFrameTypeException("Expecting WebSocketFrame. Unknown type."); } if (msg instanceof TextWebSocketFrame) { TextWebSocketFrame textWebSocketFrame = (TextWebSocketFrame) msg; String text = textWebSocketFrame.text(); cMsg = new TextCarbonMessage(text); } else if (msg instanceof BinaryWebSocketFrame) { BinaryWebSocketFrame binaryWebSocketFrame = (BinaryWebSocketFrame) msg; boolean finalFragment = binaryWebSocketFrame.isFinalFragment(); ByteBuf byteBuf = binaryWebSocketFrame.content(); ByteBuffer byteBuffer = byteBuf.nioBuffer(); cMsg = new BinaryCarbonMessage(byteBuffer, finalFragment); } else if (msg instanceof CloseWebSocketFrame) { CloseWebSocketFrame closeWebSocketFrame = (CloseWebSocketFrame) msg; String reasonText = closeWebSocketFrame.reasonText(); int statusCode = closeWebSocketFrame.statusCode(); ctx.channel().close(); cMsg = new StatusCarbonMessage(org.wso2.carbon.messaging.Constants.STATUS_CLOSE, statusCode, reasonText); } else if (msg instanceof PongWebSocketFrame) { PongWebSocketFrame pongWebSocketFrame = (PongWebSocketFrame) msg; boolean finalFragment = pongWebSocketFrame.isFinalFragment(); ByteBuf byteBuf = pongWebSocketFrame.content(); ByteBuffer byteBuffer = byteBuf.nioBuffer(); cMsg = new ControlCarbonMessage(byteBuffer, finalFragment); byteBuf.release(); } setupCarbonMessage(ctx); publishToMessageProcessor(cMsg); }

Target:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws UnknownWebSocketFrameTypeException { cMsg = null; if (!(msg instanceof WebSocketFrame)) { logger.error("Expecting WebSocketFrame. Unknown type."); throw new UnknownWebSocketFrameTypeException("Expecting WebSocketFrame. Unknown type."); } if (msg instanceof TextWebSocketFrame) { TextWebSocketFrame textWebSocketFrame = (TextWebSocketFrame) msg; String text = textWebSocketFrame.text(); cMsg = new TextCarbonMessage(text); } else if (msg instanceof BinaryWebSocketFrame) { BinaryWebSocketFrame binaryWebSocketFrame = (BinaryWebSocketFrame) msg; boolean finalFragment = binaryWebSocketFrame.isFinalFragment(); ByteBuf byteBuf = binaryWebSocketFrame.content(); ByteBuffer byteBuffer = byteBuf.nioBuffer(); cMsg = new BinaryCarbonMessage(byteBuffer, finalFragment); } else if (msg instanceof CloseWebSocketFrame) { CloseWebSocketFrame closeWebSocketFrame = (CloseWebSocketFrame) msg; String reasonText = closeWebSocketFrame.reasonText(); int statusCode = closeWebSocketFrame.statusCode(); ctx.channel().close(); cMsg = new StatusCarbonMessage(org.wso2.carbon.messaging.Constants.STATUS_CLOSE, statusCode, reasonText); } else if (msg instanceof PongWebSocketFrame) { PongWebSocketFrame pongWebSocketFrame = (PongWebSocketFrame) msg; boolean finalFragment = pongWebSocketFrame.isFinalFragment(); ByteBuf byteBuf = pongWebSocketFrame.content(); ByteBuffer byteBuffer = byteBuf.nioBuffer(); cMsg = new ControlCarbonMessage(byteBuffer, finalFragment); byteBuf.release(); } setupCarbonMessage(ctx); publishToMessageProcessor(cMsg); }