io.netty.channel.ChannelHandlerContext#read ( )源码实例Demo

下面列出了io.netty.channel.ChannelHandlerContext#read ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: reactor-netty   文件: HAProxyMessageReader.java
@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);
	}
}
 
源代码2 项目: reactor-netty   文件: SslProvider.java
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
	if (!handshakeDone) {
		ctx.read(); /* continue consuming. */
	}
	ctx.fireChannelReadComplete();
}
 
源代码3 项目: netty-4.1.22   文件: MessageAggregator.java
@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();
}
 
源代码4 项目: netty4.0.27Learn   文件: SocketSpdyEchoTest.java
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    try {
        ctx.flush();
    } finally {
        if (!autoRead) {
            ctx.read();
        }
    }
}
 
源代码5 项目: netty-4.1.22   文件: FlowControlHandler.java
@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();
    }
}
 
源代码6 项目: netty-4.1.22   文件: SocketStartTlsTest.java
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
    channel = ctx.channel();
    if (!autoRead) {
        ctx.read();
    }
}
 
源代码7 项目: servicetalk   文件: DefaultNettyConnection.java
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();
    }
}
 
源代码8 项目: servicetalk   文件: AlpnChannelSingle.java
@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();
    }
}
 
源代码9 项目: netty4.0.27Learn   文件: SocketSpdyEchoTest.java
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    if (!autoRead) {
        ctx.read();
    }
}
 
@Override
public void read(ChannelHandlerContext ctx) throws Exception {
    ctx.read();
}
 
源代码11 项目: waltz   文件: ProxyServer.java
@Override
public void channelActive(ChannelHandlerContext ctx) {
    ctx.read();
}
 
源代码12 项目: netty-4.1.22   文件: HttpClientUpgradeHandler.java
@Override
public void read(ChannelHandlerContext ctx) throws Exception {
    ctx.read();
}
 
源代码13 项目: netty-4.1.22   文件: SocketSpdyEchoTest.java
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
    if (!autoRead) {
        ctx.read();
    }
}
 
源代码14 项目: bazel-buildfarm   文件: AbstractHttpHandler.java
@SuppressWarnings("FutureReturnValueIgnored")
@Override
public void read(ChannelHandlerContext ctx) {
  ctx.read();
}
 
源代码15 项目: riiablo   文件: EndpointedChannelHandler.java
@Override
public void read(ChannelHandlerContext ctx) throws Exception {
  if (DEBUG_CALLS) Gdx.app.debug(TAG, "read");
  ctx.read();
}
 
源代码16 项目: reactor-netty   文件: SslProvider.java
@Override
public void channelActive(ChannelHandlerContext ctx) {
	ctx.read(); //consume handshake
}
 
@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();
}
 
源代码18 项目: netty-4.1.22   文件: SocketSslEchoTest.java
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
    if (!autoRead) {
        ctx.read();
    }
}
 
源代码19 项目: netty-4.1.22   文件: Http2ConnectionHandler.java
@Override
public void read(ChannelHandlerContext ctx) throws Exception {
    ctx.read();
}
 
@Override
public void read(ChannelHandlerContext ctx) throws Exception {
  ctx.read();
}