* Added DummyHandler for testing

* Suppressed unnecessary warning messages
This commit is contained in:
Trustin Lee 2008-09-06 09:30:20 +00:00
parent e34d494496
commit beb0fb0d6f
4 changed files with 31 additions and 7 deletions

View File

@ -38,6 +38,7 @@ import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.ChannelPipelineException;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.util.DummyHandler;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@ -96,6 +97,8 @@ public abstract class AbstractSocketClientBootstrapTest {
ClientBootstrap bootstrap =
new ClientBootstrap(newClientSocketChannelFactory(executor));
bootstrap.getPipeline().addLast("dummy", new DummyHandler());
bootstrap.setOption(
"remoteAddress",
new InetSocketAddress(
@ -131,6 +134,8 @@ public abstract class AbstractSocketClientBootstrapTest {
ClientBootstrap bootstrap =
new ClientBootstrap(newClientSocketChannelFactory(executor));
bootstrap.getPipeline().addLast("dummy", new DummyHandler());
bootstrap.setOption(
"remoteAddress",
new InetSocketAddress(

View File

@ -44,6 +44,7 @@ import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.ChildChannelStateEvent;
import org.jboss.netty.channel.SimpleChannelHandler;
import org.jboss.netty.channel.socket.SocketChannelConfig;
import org.jboss.netty.util.DummyHandler;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@ -199,11 +200,4 @@ public abstract class AbstractSocketServerBootstrapTest {
result.append('1');
}
}
@ChannelPipelineCoverage("all")
private static class DummyHandler extends SimpleChannelHandler {
DummyHandler() {
super();
}
}
}

View File

@ -35,6 +35,7 @@ import java.util.concurrent.TimeUnit;
import org.jboss.netty.bootstrap.ClientBootstrap;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
import org.jboss.netty.util.DummyHandler;
import org.junit.Test;
@ -57,6 +58,7 @@ public class NioClientSocketShutdownTimeTest {
ExecutorService e1 = Executors.newCachedThreadPool();
ExecutorService e2 = Executors.newCachedThreadPool();
ClientBootstrap b = new ClientBootstrap(new NioClientSocketChannelFactory(e1, e2));
b.getPipeline().addLast("handler", new DummyHandler());
try {
serverSocket.configureBlocking(false);

View File

@ -0,0 +1,23 @@
package org.jboss.netty.util;
import org.jboss.netty.channel.ChannelEvent;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipelineCoverage;
import org.jboss.netty.channel.ChannelUpstreamHandler;
/**
* A dummy handler for a testing purpose.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
*
* @version $Rev$, $Date$
*/
@ChannelPipelineCoverage("all")
public class DummyHandler implements ChannelUpstreamHandler {
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e)
throws Exception {
// Do nothing.
}
}