Netty <===> NotNetty

zx spectrum webakaunt at gmail.com
Thu Oct 13 17:16:21 EDT 2011


Is there anything specific that needs to be done when connecting a netty
client to a non Netty server ( developed in some other language, etc.. )?

Besides this:

    val bootstrap = new ClientBootstrap(
      new NioClientSocketChannelFactory(
        Executors.newCachedThreadPool,
        Executors.newCachedThreadPool ) )

    bootstrap.setPipelineFactory( new ChannelPipelineFactory {
        def getPipeline = {
          Channels.pipeline( channelHandlers.toArray : _* )
        }
    } )

    bootstrap.setOption( "remoteAddress", new InetSocketAddress( host, port
) )

    val channel = bootstrap.connect.getChannel   // <= this succeeds

    clientChannel.write( ChannelBuffers.wrappedBuffer( message ) )

It throws a NotYetConnected exception.

If I do "clientChannel.write( ChannelBuffers.wrappedBuffer( message ), new
InetSocketAddress( host, port ) )" instead, it throws a
"java.net.ConnectException: connection timed out"

Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20111013/8806b850/attachment.html 


More information about the netty-users mailing list