Used logger instead of syserr

This commit is contained in:
Trustin Lee 2008-11-16 13:34:24 +00:00
parent 4cd9105eeb
commit 9aec8119cb

View File

@ -52,6 +52,8 @@ import org.jboss.netty.channel.SimpleChannelHandler;
import org.jboss.netty.example.securechat.SecureChatSslContextFactory; import org.jboss.netty.example.securechat.SecureChatSslContextFactory;
import org.jboss.netty.handler.execution.ExecutionHandler; import org.jboss.netty.handler.execution.ExecutionHandler;
import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
import org.jboss.netty.logging.InternalLogger;
import org.jboss.netty.logging.InternalLoggerFactory;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -65,6 +67,8 @@ import org.junit.Test;
* *
*/ */
public abstract class AbstractSocketSslEchoTest { public abstract class AbstractSocketSslEchoTest {
static final InternalLogger logger =
InternalLoggerFactory.getInstance(AbstractSocketSslEchoTest.class);
private static final Random random = new Random(); private static final Random random = new Random();
static final byte[] data = new byte[1048576]; static final byte[] data = new byte[1048576];
@ -150,8 +154,7 @@ 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.err.println("Handshake failed:"); logger.error("Handshake failed", hf.getCause());
hf.getCause().printStackTrace();
} }
assertTrue(hf.isSuccess()); assertTrue(hf.isSuccess());
@ -248,8 +251,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());
exception.compareAndSet(null, e.getCause()); exception.compareAndSet(null, e.getCause());
e.getCause().printStackTrace();
e.getChannel().close(); e.getChannel().close();
} }
} }