diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java index 213441bafc..bfc4dbedc0 100644 --- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java +++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java @@ -23,6 +23,7 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.util.concurrent.DefaultEventExecutorGroup; import io.netty.util.concurrent.EventExecutorGroup; @@ -150,6 +151,8 @@ public class SocketEchoTest extends AbstractSocketTest { }); cb.handler(ch); } + sb.childOption(ChannelOption.AUTO_READ, autoRead); + cb.option(ChannelOption.AUTO_READ, autoRead); Channel sc = sb.bind().sync().channel(); Channel cc = cb.connect().sync().channel(); @@ -227,6 +230,9 @@ public class SocketEchoTest extends AbstractSocketTest { public void channelActive(ChannelHandlerContext ctx) throws Exception { channel = ctx.channel(); + if (!autoRead) { + ctx.read(); + } } @Override diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFileRegionTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFileRegionTest.java index bcee780e0f..4a44c62171 100644 --- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFileRegionTest.java +++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFileRegionTest.java @@ -22,6 +22,7 @@ import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandler; +import io.netty.channel.ChannelOption; import io.netty.channel.DefaultFileRegion; import io.netty.channel.FileRegion; import io.netty.channel.SimpleChannelInboundHandler; @@ -84,6 +85,9 @@ public class SocketFileRegionTest extends AbstractSocketTest { private static void testFileRegion0( ServerBootstrap sb, Bootstrap cb, boolean voidPromise, final boolean autoRead) throws Throwable { + sb.childOption(ChannelOption.AUTO_READ, autoRead); + cb.option(ChannelOption.AUTO_READ, autoRead); + final int bufferSize = 1024; final File file = File.createTempFile("netty-", ".tmp"); file.deleteOnExit(); @@ -193,6 +197,9 @@ public class SocketFileRegionTest extends AbstractSocketTest { public void channelActive(ChannelHandlerContext ctx) throws Exception { channel = ctx.channel(); + if (!autoRead) { + ctx.read(); + } } @Override diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFixedLengthEchoTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFixedLengthEchoTest.java index 013f55e1e6..996121e6c7 100644 --- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFixedLengthEchoTest.java +++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFixedLengthEchoTest.java @@ -22,6 +22,7 @@ import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.FixedLengthFrameDecoder; import org.junit.Test; @@ -63,6 +64,7 @@ public class SocketFixedLengthEchoTest extends AbstractSocketTest { final EchoHandler sh = new EchoHandler(autoRead); final EchoHandler ch = new EchoHandler(autoRead); + sb.childOption(ChannelOption.AUTO_READ, autoRead); sb.childHandler(new ChannelInitializer() { @Override public void initChannel(Channel sch) throws Exception { @@ -71,6 +73,7 @@ public class SocketFixedLengthEchoTest extends AbstractSocketTest { } }); + cb.option(ChannelOption.AUTO_READ, autoRead); cb.handler(new ChannelInitializer() { @Override public void initChannel(Channel sch) throws Exception { @@ -148,6 +151,9 @@ public class SocketFixedLengthEchoTest extends AbstractSocketTest { @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { channel = ctx.channel(); + if (!autoRead) { + ctx.read(); + } } @Override diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketGatheringWriteTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketGatheringWriteTest.java index 0a966f8f1f..bec2bf46e4 100644 --- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketGatheringWriteTest.java +++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketGatheringWriteTest.java @@ -23,6 +23,7 @@ import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelOption; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.testsuite.util.TestUtils; import io.netty.util.internal.StringUtil; @@ -104,6 +105,9 @@ public class SocketGatheringWriteTest extends AbstractSocketTest { private void testGatheringWrite0( ServerBootstrap sb, Bootstrap cb, byte[] data, boolean composite, boolean autoRead) throws Throwable { + sb.childOption(ChannelOption.AUTO_READ, autoRead); + cb.option(ChannelOption.AUTO_READ, autoRead); + final TestHandler sh = new TestHandler(autoRead); final TestHandler ch = new TestHandler(autoRead); @@ -190,6 +194,9 @@ public class SocketGatheringWriteTest extends AbstractSocketTest { public void channelActive(ChannelHandlerContext ctx) throws Exception { channel = ctx.channel(); + if (!autoRead) { + ctx.read(); + } } @Override diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketObjectEchoTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketObjectEchoTest.java index 10945c44f4..ba0085eb43 100644 --- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketObjectEchoTest.java +++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketObjectEchoTest.java @@ -21,6 +21,7 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; import io.netty.handler.codec.serialization.ClassResolvers; import io.netty.handler.codec.serialization.ObjectDecoder; import io.netty.handler.codec.serialization.ObjectEncoder; @@ -68,6 +69,9 @@ public class SocketObjectEchoTest extends AbstractSocketTest { } private static void testObjectEcho(ServerBootstrap sb, Bootstrap cb, boolean autoRead) throws Throwable { + sb.childOption(ChannelOption.AUTO_READ, autoRead); + cb.option(ChannelOption.AUTO_READ, autoRead); + final EchoHandler sh = new EchoHandler(autoRead); final EchoHandler ch = new EchoHandler(autoRead); @@ -159,6 +163,9 @@ public class SocketObjectEchoTest extends AbstractSocketTest { public void channelActive(ChannelHandlerContext ctx) throws Exception { channel = ctx.channel(); + if (!autoRead) { + ctx.read(); + } } @Override diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSpdyEchoTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSpdyEchoTest.java index 8e5ef76739..d0162014c9 100644 --- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSpdyEchoTest.java +++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSpdyEchoTest.java @@ -23,6 +23,7 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.socket.SocketChannel; import io.netty.handler.codec.spdy.SpdyFrameCodec; @@ -176,6 +177,9 @@ public class SocketSpdyEchoTest extends AbstractSocketTest { throw new IllegalArgumentException("unknown version"); } + sb.childOption(ChannelOption.AUTO_READ, autoRead); + cb.option(ChannelOption.AUTO_READ, autoRead); + final SpdyEchoTestServerHandler sh = new SpdyEchoTestServerHandler(autoRead); final SpdyEchoTestClientHandler ch = new SpdyEchoTestClientHandler(frames.copy(), autoRead); @@ -233,6 +237,13 @@ public class SocketSpdyEchoTest extends AbstractSocketTest { this.autoRead = autoRead; } + @Override + public void channelActive(ChannelHandlerContext ctx) throws Exception { + if (!autoRead) { + ctx.read(); + } + } + @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { ctx.write(msg); @@ -267,6 +278,12 @@ public class SocketSpdyEchoTest extends AbstractSocketTest { this.frames = frames; this.autoRead = autoRead; } + @Override + public void channelActive(ChannelHandlerContext ctx) throws Exception { + if (!autoRead) { + ctx.read(); + } + } @Override public void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception { diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslEchoTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslEchoTest.java index 36dcfdb4a0..7b82ecab2e 100644 --- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslEchoTest.java +++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslEchoTest.java @@ -24,6 +24,7 @@ import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.ssl.JdkSslClientContext; import io.netty.handler.ssl.JdkSslServerContext; @@ -221,6 +222,9 @@ public class SocketSslEchoTest extends AbstractSocketTest { final ExecutorService delegatedTaskExecutor = Executors.newCachedThreadPool(); reset(); + sb.childOption(ChannelOption.AUTO_READ, autoRead); + cb.option(ChannelOption.AUTO_READ, autoRead); + sb.childHandler(new ChannelInitializer() { @Override @SuppressWarnings("deprecation") @@ -419,6 +423,13 @@ public class SocketSslEchoTest extends AbstractSocketTest { this.exception = exception; } + @Override + public void channelActive(ChannelHandlerContext ctx) throws Exception { + if (!autoRead) { + ctx.read(); + } + } + @Override public final void channelReadComplete(ChannelHandlerContext ctx) throws Exception { try { diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketStartTlsTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketStartTlsTest.java index 132a94fe51..66f3fa2d1e 100644 --- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketStartTlsTest.java +++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketStartTlsTest.java @@ -21,6 +21,7 @@ import io.netty.buffer.PooledByteBufAllocator; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; import io.netty.channel.ChannelPipeline; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.LineBasedFrameDecoder; @@ -142,6 +143,9 @@ public class SocketStartTlsTest extends AbstractSocketTest { } private void testStartTls(ServerBootstrap sb, Bootstrap cb, boolean autoRead) throws Throwable { + sb.childOption(ChannelOption.AUTO_READ, autoRead); + cb.option(ChannelOption.AUTO_READ, autoRead); + final EventExecutorGroup executor = SocketStartTlsTest.executor; SSLEngine sse = serverCtx.newEngine(PooledByteBufAllocator.DEFAULT); SSLEngine cse = clientCtx.newEngine(PooledByteBufAllocator.DEFAULT); @@ -235,6 +239,9 @@ public class SocketStartTlsTest extends AbstractSocketTest { @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { + if (!autoRead) { + ctx.read(); + } ctx.writeAndFlush("StartTlsRequest\n"); } @@ -287,6 +294,9 @@ public class SocketStartTlsTest extends AbstractSocketTest { @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { channel = ctx.channel(); + if (!autoRead) { + ctx.read(); + } } @Override diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketStringEchoTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketStringEchoTest.java index c43204bfb8..c5bd0883c0 100644 --- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketStringEchoTest.java +++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketStringEchoTest.java @@ -20,6 +20,7 @@ import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.DelimiterBasedFrameDecoder; import io.netty.handler.codec.Delimiters; @@ -70,6 +71,9 @@ public class SocketStringEchoTest extends AbstractSocketTest { } private static void testStringEcho(ServerBootstrap sb, Bootstrap cb, boolean autoRead) throws Throwable { + sb.childOption(ChannelOption.AUTO_READ, autoRead); + cb.option(ChannelOption.AUTO_READ, autoRead); + final StringEchoHandler sh = new StringEchoHandler(autoRead); final StringEchoHandler ch = new StringEchoHandler(autoRead); @@ -160,6 +164,9 @@ public class SocketStringEchoTest extends AbstractSocketTest { @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { channel = ctx.channel(); + if (!autoRead) { + ctx.read(); + } } @Override