Better diagnosis message for AbstractSocketSslEchoTest
This commit is contained in:
parent
8c172a5a1d
commit
9252f449bd
@ -103,8 +103,8 @@ public abstract class AbstractSocketSslEchoTest {
|
|||||||
ServerBootstrap sb = new ServerBootstrap(newServerSocketChannelFactory(executor));
|
ServerBootstrap sb = new ServerBootstrap(newServerSocketChannelFactory(executor));
|
||||||
ClientBootstrap cb = new ClientBootstrap(newClientSocketChannelFactory(executor));
|
ClientBootstrap cb = new ClientBootstrap(newClientSocketChannelFactory(executor));
|
||||||
|
|
||||||
EchoHandler sh = new EchoHandler();
|
EchoHandler sh = new EchoHandler(true);
|
||||||
EchoHandler ch = new EchoHandler();
|
EchoHandler ch = new EchoHandler(false);
|
||||||
|
|
||||||
SSLEngine sse = SecureChatSslContextFactory.getServerContext().createSSLEngine();
|
SSLEngine sse = SecureChatSslContextFactory.getServerContext().createSSLEngine();
|
||||||
SSLEngine cse = SecureChatSslContextFactory.getClientContext().createSSLEngine();
|
SSLEngine cse = SecureChatSslContextFactory.getClientContext().createSSLEngine();
|
||||||
@ -189,19 +189,15 @@ public abstract class AbstractSocketSslEchoTest {
|
|||||||
sc.close().awaitUninterruptibly();
|
sc.close().awaitUninterruptibly();
|
||||||
|
|
||||||
if (sh.exception.get() != null && !(sh.exception.get() instanceof IOException)) {
|
if (sh.exception.get() != null && !(sh.exception.get() instanceof IOException)) {
|
||||||
System.err.println("Exception raised from the server side.");
|
|
||||||
throw sh.exception.get();
|
throw sh.exception.get();
|
||||||
}
|
}
|
||||||
if (ch.exception.get() != null && !(ch.exception.get() instanceof IOException)) {
|
if (ch.exception.get() != null && !(ch.exception.get() instanceof IOException)) {
|
||||||
System.err.println("Exception raised from the client side.");
|
|
||||||
throw ch.exception.get();
|
throw ch.exception.get();
|
||||||
}
|
}
|
||||||
if (sh.exception.get() != null) {
|
if (sh.exception.get() != null) {
|
||||||
System.err.println("Exception raised from the server side.");
|
|
||||||
throw sh.exception.get();
|
throw sh.exception.get();
|
||||||
}
|
}
|
||||||
if (ch.exception.get() != null) {
|
if (ch.exception.get() != null) {
|
||||||
System.err.println("Exception raised from the client side.");
|
|
||||||
throw ch.exception.get();
|
throw ch.exception.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,9 +207,10 @@ public abstract class AbstractSocketSslEchoTest {
|
|||||||
volatile Channel channel;
|
volatile Channel channel;
|
||||||
final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
|
final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
|
||||||
volatile int counter;
|
volatile int counter;
|
||||||
|
private final boolean server;
|
||||||
|
|
||||||
EchoHandler() {
|
EchoHandler(boolean server) {
|
||||||
super();
|
this.server = server;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -244,7 +241,9 @@ public abstract class AbstractSocketSslEchoTest {
|
|||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
|
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
logger.warn("Unexpected exception", e.getCause());
|
logger.warn(
|
||||||
|
"Unexpected exception from the " +
|
||||||
|
(server? "server" : "client") + " side", e.getCause());
|
||||||
|
|
||||||
exception.compareAndSet(null, e.getCause());
|
exception.compareAndSet(null, e.getCause());
|
||||||
e.getChannel().close();
|
e.getChannel().close();
|
||||||
|
Loading…
Reference in New Issue
Block a user