Java Code Examples for io.netty.channel.ChannelHandlerContext#read()
The following examples show how to use
io.netty.channel.ChannelHandlerContext#read() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HAProxyMessageReader.java From reactor-netty with Apache License 2.0 | 6 votes |
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HAProxyMessage) { HAProxyMessage proxyMessage = (HAProxyMessage) msg; if (proxyMessage.sourceAddress() != null && proxyMessage.sourcePort() != 0) { InetSocketAddress remoteAddress = AddressUtils .createUnresolved(proxyMessage.sourceAddress(), proxyMessage.sourcePort()); ctx.channel() .attr(REMOTE_ADDRESS_FROM_PROXY_PROTOCOL) .set(remoteAddress); } proxyMessage.release(); ctx.channel() .pipeline() .remove(this); ctx.read(); } else { super.channelRead(ctx, msg); } }
Example 2
Source File: SslProvider.java From reactor-netty with Apache License 2.0 | 5 votes |
@Override public void channelReadComplete(ChannelHandlerContext ctx) { if (!handshakeDone) { ctx.read(); /* continue consuming. */ } ctx.fireChannelReadComplete(); }
Example 3
Source File: MessageAggregator.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { // We might need keep reading the channel until the full message is aggregated.我们可能需要一直读取通道,直到聚合完整的消息。 // // See https://github.com/netty/netty/issues/6583 if (currentMessage != null && !ctx.channel().config().isAutoRead()) { ctx.read(); } ctx.fireChannelReadComplete(); }
Example 4
Source File: AlpnChannelSingle.java From servicetalk with Apache License 2.0 | 5 votes |
@Override public void handlerAdded(final ChannelHandlerContext ctx) throws Exception { super.handlerAdded(ctx); if (forceRead) { // Force a read to get the SSL handshake started. We initialize pipeline before // SslHandshakeCompletionEvent will complete, therefore, no data will be propagated before we finish // initialization. ctx.read(); } }
Example 5
Source File: SocketSpdyEchoTest.java From netty4.0.27Learn with Apache License 2.0 | 5 votes |
@Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { try { ctx.flush(); } finally { if (!autoRead) { ctx.read(); } } }
Example 6
Source File: DefaultNettyConnection.java From servicetalk with Apache License 2.0 | 5 votes |
private void doChannelActive(ChannelHandlerContext ctx) { if (waitForSslHandshake) { // Force a read to get the SSL handshake started, any application data that makes it past the SslHandler // will be queued in the NettyChannelPublisher. ctx.read(); } else if (subscriber != null) { completeSubscriber(); } }
Example 7
Source File: FlowControlHandler.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Override public void read(ChannelHandlerContext ctx) throws Exception { if (dequeue(ctx, 1) == 0) { // It seems no messages were consumed. We need to read() some // messages from upstream and once one arrives it need to be // relayed to downstream to keep the flow going. shouldConsume = true; ctx.read(); } }
Example 8
Source File: SocketStartTlsTest.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { channel = ctx.channel(); if (!autoRead) { ctx.read(); } }
Example 9
Source File: SslProvider.java From reactor-netty with Apache License 2.0 | 4 votes |
@Override public void channelActive(ChannelHandlerContext ctx) { ctx.read(); //consume handshake }
Example 10
Source File: ConnectInterceptingHandler.java From java-dcp-client with Apache License 2.0 | 4 votes |
@Override public void read(ChannelHandlerContext ctx) throws Exception { ctx.read(); }
Example 11
Source File: Http2ConnectionHandler.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
@Override public void read(ChannelHandlerContext ctx) throws Exception { ctx.read(); }
Example 12
Source File: SocketSslEchoTest.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { if (!autoRead) { ctx.read(); } }
Example 13
Source File: DetectPeerCloseWithoutReadTest.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
@Override protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception { bytesRead.addAndGet(msg.readableBytes()); // Because autoread is off, we call read to consume all data until we detect the close. ctx.read(); }
Example 14
Source File: SocketSpdyEchoTest.java From netty4.0.27Learn with Apache License 2.0 | 4 votes |
@Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { if (!autoRead) { ctx.read(); } }
Example 15
Source File: EndpointedChannelHandler.java From riiablo with Apache License 2.0 | 4 votes |
@Override public void read(ChannelHandlerContext ctx) throws Exception { if (DEBUG_CALLS) Gdx.app.debug(TAG, "read"); ctx.read(); }
Example 16
Source File: AbstractHttpHandler.java From bazel-buildfarm with Apache License 2.0 | 4 votes |
@SuppressWarnings("FutureReturnValueIgnored") @Override public void read(ChannelHandlerContext ctx) { ctx.read(); }
Example 17
Source File: SocketSpdyEchoTest.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { if (!autoRead) { ctx.read(); } }
Example 18
Source File: HttpClientUpgradeHandler.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
@Override public void read(ChannelHandlerContext ctx) throws Exception { ctx.read(); }
Example 19
Source File: ProxyServer.java From waltz with Apache License 2.0 | 4 votes |
@Override public void channelActive(ChannelHandlerContext ctx) { ctx.read(); }
Example 20
Source File: KeyValueSelectBucketHandler.java From couchbase-jvm-core with Apache License 2.0 | 4 votes |
@Override public void read(ChannelHandlerContext ctx) throws Exception { ctx.read(); }