SSLException in SslHandler; based on SecureChat example

nollie jon_whitmore at sra.com
Mon Mar 22 15:46:17 EDT 2010


Hello

I was having this same issue, although more often.  I wove together the HTTP
examples with the secure chat example and failed about 45% of the time using
JDK 5 and Netty 3.1.5.GA.  It didn't look good.

I sat down with Trustin's test and looked for anything that could be
different in my code and I found it.

If you started with the HttpClient example, you probably have this in your
code:

        // Wait until the connection attempt succeeds or fails.
        final Channel channel = future.awaitUninterruptibly().getChannel();
        if (!future.isSuccess()) {
          // log failure
          // exit
        }
        // ... otherwise continue


Change that bit of code to use a listener, like this:

        future.addListener(new ChannelFutureListener() {
            public void operationComplete(final ChannelFuture cf) throws
Exception {
                if ( cf.isSuccess() ) {
                    sendFirstCommand(cf.getChannel());

                } else {
                    // log failure
                    // exit
                }
            }
        });


I made the change and ran 50 times without issue.  Hope this helps.


 Jon


-- 
View this message in context: http://n2.nabble.com/SSLException-in-SslHandler-based-on-SecureChat-example-tp2628574p4779985.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list