Why Channel.isConnected() returned true even though there is no UDP server?

hezjing hezjing at gmail.com
Mon Apr 20 01:32:37 EDT 2009


Hi

Here is my UDP client snippet,

        ChannelFactory factory = new
OioDatagramChannelFactory(Executors.newCachedThreadPool());
        ClientBootstrap bootstrap = new ClientBootstrap(factory);
        ChannelPipeline pipeline = bootstrap.getPipeline();
        pipeline.addLast("logger", new LoggingHandler());

        // connect to a non-exist IP address or port
        ChannelFuture future = bootstrap.connect(new
InetSocketAddress("localhost", 8899));
        future.awaitUninterruptibly();
        Channel channel = future.getChannel();

        // channel.isConnected() returned true?
        logger.debug("channel.isConnected() returned {}",
channel.isConnected());


when run, the channel.isConnected() returned true even though there is no
server listening at localhost:8899.

Is this an expected behavior?


-- 

Hez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20090420/2f6940e1/attachment.html 


More information about the netty-users mailing list