Fixed a problem where not all exceptions are logged immediately in AbstractSocketSslEchoTest

This commit is contained in:
Trustin Lee 2008-11-16 11:43:44 +00:00
parent 834277a9eb
commit ea94ea850b

View File

@ -150,12 +150,8 @@ public abstract class AbstractSocketSslEchoTest {
ChannelFuture hf = cc.getPipeline().get(SslHandler.class).handshake(cc); ChannelFuture hf = cc.getPipeline().get(SslHandler.class).handshake(cc);
hf.awaitUninterruptibly(); hf.awaitUninterruptibly();
if (!hf.isSuccess()) { if (!hf.isSuccess()) {
System.out.println("Handshake failed:"); System.err.println("Handshake failed:");
hf.getCause().printStackTrace(System.out); hf.getCause().printStackTrace();
if (ch.exception.get() != null) {
System.out.println("Exception recorded by ChannelHandler:");
ch.exception.get().printStackTrace(System.out);
}
} }
assertTrue(hf.isSuccess()); assertTrue(hf.isSuccess());
@ -253,6 +249,7 @@ public abstract class AbstractSocketSslEchoTest {
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception { throws Exception {
if (exception.compareAndSet(null, e.getCause())) { if (exception.compareAndSet(null, e.getCause())) {
e.getCause().printStackTrace();
e.getChannel().close(); e.getChannel().close();
} }
} }