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.
This commit is contained in:
parent
778ee88ada
commit
1a8a2cac13
@ -21,6 +21,7 @@ import io.netty.channel.ChannelFuture;
|
|||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerAdapter;
|
import io.netty.channel.ChannelHandlerAdapter;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -51,6 +52,7 @@ public class NioSocketChannelTest {
|
|||||||
|
|
||||||
ServerBootstrap sb = new ServerBootstrap();
|
ServerBootstrap sb = new ServerBootstrap();
|
||||||
sb.group(group).channel(NioServerSocketChannel.class);
|
sb.group(group).channel(NioServerSocketChannel.class);
|
||||||
|
sb.childOption(ChannelOption.SO_SNDBUF, 1024);
|
||||||
sb.childHandler(new ChannelHandlerAdapter() {
|
sb.childHandler(new ChannelHandlerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
Loading…
Reference in New Issue
Block a user