List of usage examples for io.netty.buffer ByteBufHolder copy
ByteBufHolder copy();
From source file:co.rsk.rpc.netty.RskJsonRpcHandler.java
License:Open Source License
@Override protected void channelRead0(ChannelHandlerContext ctx, ByteBufHolder msg) { try {/*from ww w. j av a 2 s . co m*/ RskJsonRpcRequest request = serializer.deserializeRequest(new ByteBufInputStream(msg.copy().content())); // TODO(mc) we should support the ModuleDescription method filters JsonRpcResultOrError resultOrError = request.accept(this, ctx); JsonRpcIdentifiableMessage response = resultOrError.responseFor(request.getId()); ctx.writeAndFlush(new TextWebSocketFrame(serializer.serializeMessage(response))); return; } catch (IOException e) { LOGGER.trace("Not a known or valid JsonRpcRequest", e); } // delegate to the next handler if the message can't be matched to a known JSON-RPC request ctx.fireChannelRead(msg.retain()); }