Fixed a failing test

This commit is contained in:
Trustin Lee 2009-08-21 04:29:48 +00:00
parent c861adf6e0
commit d842533135

View File

@ -26,8 +26,8 @@ import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
@ -108,14 +108,16 @@ public abstract class AbstractSocketServerBootstrapTest {
@Test(timeout = 30000, expected = ChannelException.class)
public void testFailedBindAttempt() throws Exception {
ServerBootstrap bootstrap = new ServerBootstrap();
bootstrap.setFactory(newServerSocketChannelFactory(executor));
bootstrap.setOption(
"localAddress",
new InetSocketAddress(
InetAddress.getByAddress(new byte[] { -1, -1, -1, -1 }),
0));
bootstrap.bind().close().awaitUninterruptibly();
final ServerSocket ss = new ServerSocket(0);
final int boundPort = ss.getLocalPort();
try {
ServerBootstrap bootstrap = new ServerBootstrap();
bootstrap.setFactory(newServerSocketChannelFactory(executor));
bootstrap.setOption("localAddress", new InetSocketAddress(boundPort));
bootstrap.bind().close().awaitUninterruptibly();
} finally {
ss.close();
}
}
@Test(timeout = 30000)