From c9faaa6e3eabb0e481bccd24ad0205a2d4d233f4 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 23 Apr 2014 09:26:09 +0200 Subject: [PATCH] Make NioSocketChannelTest more bullet-proof Motivation: I had the NioSocketChannelTest.testFlushCloseReentrance() fail sometimes on one of my linux installation. This change let it pass all the time. Modification: Set the SO_SNDBUF to a small value to force split writes Result: Test is passing all the time where it was sometimes fail before. --- .../test/java/io/netty/channel/nio/NioSocketChannelTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/transport/src/test/java/io/netty/channel/nio/NioSocketChannelTest.java b/transport/src/test/java/io/netty/channel/nio/NioSocketChannelTest.java index 0844167b8c..125ab4d1e7 100644 --- a/transport/src/test/java/io/netty/channel/nio/NioSocketChannelTest.java +++ b/transport/src/test/java/io/netty/channel/nio/NioSocketChannelTest.java @@ -21,6 +21,7 @@ import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; +import io.netty.channel.ChannelOption; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.util.CharsetUtil; import org.junit.Test; @@ -51,6 +52,7 @@ public class NioSocketChannelTest { ServerBootstrap sb = new ServerBootstrap(); sb.group(group).channel(NioServerSocketChannel.class); + sb.childOption(ChannelOption.SO_SNDBUF, 1024); sb.childHandler(new ChannelInboundHandlerAdapter() { @Override public void channelActive(ChannelHandlerContext ctx) throws Exception {