diff --git a/example/src/main/java/io/netty/example/proxy/HexDumpProxy.java b/example/src/main/java/io/netty/example/proxy/HexDumpProxy.java index 5f0c9781ed..a808b43fee 100644 --- a/example/src/main/java/io/netty/example/proxy/HexDumpProxy.java +++ b/example/src/main/java/io/netty/example/proxy/HexDumpProxy.java @@ -16,6 +16,7 @@ package io.netty.example.proxy; import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.ChannelOption; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioServerSocketChannel; @@ -41,8 +42,8 @@ public class HexDumpProxy { try { b.group(new NioEventLoopGroup(), new NioEventLoopGroup()) .channel(NioServerSocketChannel.class) - .childHandler(new HexDumpProxyInitializer(remoteHost, remotePort)); - + .childHandler(new HexDumpProxyInitializer(remoteHost, remotePort)) + .childOption(ChannelOption.AUTO_READ, false); b.bind(localPort).sync().channel().closeFuture().sync(); } finally { b.shutdown(); diff --git a/example/src/main/java/io/netty/example/proxy/HexDumpProxyFrontendHandler.java b/example/src/main/java/io/netty/example/proxy/HexDumpProxyFrontendHandler.java index 449bf540bc..8917a94f6b 100644 --- a/example/src/main/java/io/netty/example/proxy/HexDumpProxyFrontendHandler.java +++ b/example/src/main/java/io/netty/example/proxy/HexDumpProxyFrontendHandler.java @@ -54,8 +54,8 @@ public class HexDumpProxyFrontendHandler extends ChannelInboundByteHandlerAdapte @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { - // Connection attempt succeeded: - // TODO: Begin to accept incoming traffic. + // connection complete start to auto read data + inboundChannel.config().setAutoRead(true); } else { // Close the connection if the connection attempt has failed. inboundChannel.close();