Finish porting netty-proxy module

- Fix problems introduced by de9c81bf6e
- Fix inspector warnings
This commit is contained in:
Trustin Lee 2014-10-14 12:46:35 +09:00
parent de9c81bf6e
commit d9739126f2
6 changed files with 13 additions and 15 deletions

View File

@ -17,9 +17,9 @@
package io.netty.handler.proxy;
import io.netty.channel.Channel;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import io.netty.channel.PendingWriteQueue;
@ -36,7 +36,7 @@ import java.net.SocketAddress;
import java.nio.channels.ConnectionPendingException;
import java.util.concurrent.TimeUnit;
public abstract class ProxyHandler extends ChannelDuplexHandler {
public abstract class ProxyHandler extends ChannelHandlerAdapter {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(ProxyHandler.class);

View File

@ -37,7 +37,7 @@ import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import io.netty.handler.ssl.util.SelfSignedCertificate;
import io.netty.util.CharsetUtil;
import io.netty.util.concurrent.DefaultThreadFactory;
import io.netty.util.concurrent.DefaultExecutorServiceFactory;
import io.netty.util.concurrent.Future;
import io.netty.util.internal.EmptyArrays;
import io.netty.util.internal.StringUtil;
@ -77,7 +77,7 @@ public class ProxyHandlerTest {
private static final String BAD_USERNAME = "badUser";
private static final String BAD_PASSWORD = "badPassword";
static final EventLoopGroup group = new NioEventLoopGroup(3, new DefaultThreadFactory("proxy", true));
static final EventLoopGroup group = new NioEventLoopGroup(3, new DefaultExecutorServiceFactory("proxy"));
static final SslContext serverSslCtx;
static final SslContext clientSslCtx;
@ -381,7 +381,7 @@ public class ProxyHandlerTest {
}
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
protected void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
String str = ((ByteBuf) msg).toString(CharsetUtil.US_ASCII);
received.add(str);
if ("2".equals(str)) {
@ -437,7 +437,7 @@ public class ProxyHandlerTest {
}
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
protected void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
fail("Unexpected message: " + msg);
}

View File

@ -24,8 +24,8 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
@ -158,7 +158,7 @@ abstract class ProxyServer {
private Channel backend;
@Override
protected final void channelRead0(final ChannelHandlerContext ctx, Object msg) throws Exception {
protected final void messageReceived(final ChannelHandlerContext ctx, Object msg) throws Exception {
if (finished) {
received.add(ReferenceCountUtil.retain(msg));
flush();
@ -232,7 +232,7 @@ abstract class ProxyServer {
ctx.close();
}
private final class BackendHandler extends ChannelInboundHandlerAdapter {
private final class BackendHandler extends ChannelHandlerAdapter {
private final ChannelHandlerContext frontend;
@ -268,7 +268,7 @@ abstract class ProxyServer {
private boolean finished;
@Override
protected final void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
protected final void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
if (finished) {
String str = ((ByteBuf) msg).toString(CharsetUtil.US_ASCII);
if ("A\n".equals(str)) {

View File

@ -28,7 +28,7 @@ final class UnresponsiveHandler extends SimpleChannelInboundHandler<Object> {
private UnresponsiveHandler() { }
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
protected void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
// Ignore
}
}

View File

@ -37,7 +37,6 @@ import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.StringUtil;
import java.io.IOException;
import java.net.ConnectException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
@ -468,7 +467,6 @@ public final class EpollSocketChannel extends AbstractEpollChannel implements So
}
final class EpollSocketUnsafe extends AbstractEpollUnsafe {
private RecvByteBufAllocator.Handle allocHandle;
private void closeOnRead(ChannelPipeline pipeline) {
inputShutdown = true;

View File

@ -435,7 +435,7 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
@Override
public final ChannelHandlerInvoker invoker() {
// return the unwrapped invoker.
return ((PausableChannelEventLoop) eventLoop().asInvoker()).unwrapInvoker();
return ((PausableChannelEventExecutor) eventLoop().asInvoker()).unwrapInvoker();
}
@Override
@ -509,7 +509,7 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
}
doRegister();
registered = true;
AbstractChannel.this.eventLoop.acceptNewTasks();
eventLoop.acceptNewTasks();
safeSetSuccess(promise);
pipeline.fireChannelRegistered();
if (isActive()) {