ServerBootStrap bind to same port with throws exception
malolasi
malolasi at gmail.com
Wed Jan 12 03:45:24 EST 2011
Hi!
I've seen that a ServerBootstrap can bind to the same port without throws a
port already in use exception, follow is code block I tested:
public class TestGen extends SimpleChannelHandler{
/**
* @param args
* @throws InterruptedException
*/
public static void main(String[] args) throws InterruptedException {
ServerBootstrap bootstrap = new ServerBootstrap(new
NioServerSocketChannelFactory(
Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline p = Channels.pipeline();
p.addLast("buss", new TestGen());
return p;
}
});
Channel c1 = bootstrap.bind(new InetSocketAddress(9000));
Channel c2 = bootstrap.bind(new InetSocketAddress(9000));
System.out.println(c1);
System.out.println(c2);
c1.close();
Thread.sleep(10000);
bootstrap.releaseExternalResources();
}
}
I'm using Netty 3.2.2.Final
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/ServerBootStrap-bind-to-same-port-with-throws-exception-tp5913769p5913769.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list