Fix test failures in ProxyHandlerTest

Motivation:

The default name resolver attempts to resolve the bad host name (destination.com) and actually succeeds, making the ProxyHandlerTest fail.

Modification:

Use NoopNameResolverGroup instead.

Result:

ProxyHandlerTest passes again.
This commit is contained in:
Trustin Lee 2014-10-14 18:18:47 +09:00
parent fa248cecb5
commit 0b0544d464

View File

@ -36,6 +36,7 @@ import io.netty.handler.codec.LineBasedFrameDecoder;
import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.util.InsecureTrustManagerFactory; import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import io.netty.handler.ssl.util.SelfSignedCertificate; import io.netty.handler.ssl.util.SelfSignedCertificate;
import io.netty.resolver.NoopNameResolverGroup;
import io.netty.util.CharsetUtil; import io.netty.util.CharsetUtil;
import io.netty.util.concurrent.DefaultExecutorServiceFactory; import io.netty.util.concurrent.DefaultExecutorServiceFactory;
import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Future;
@ -522,6 +523,7 @@ public class ProxyHandlerTest {
Bootstrap b = new Bootstrap(); Bootstrap b = new Bootstrap();
b.group(group); b.group(group);
b.channel(NioSocketChannel.class); b.channel(NioSocketChannel.class);
b.resolver(NoopNameResolverGroup.INSTANCE);
b.handler(new ChannelInitializer<SocketChannel>() { b.handler(new ChannelInitializer<SocketChannel>() {
@Override @Override
protected void initChannel(SocketChannel ch) throws Exception { protected void initChannel(SocketChannel ch) throws Exception {
@ -569,6 +571,7 @@ public class ProxyHandlerTest {
Bootstrap b = new Bootstrap(); Bootstrap b = new Bootstrap();
b.group(group); b.group(group);
b.channel(NioSocketChannel.class); b.channel(NioSocketChannel.class);
b.resolver(NoopNameResolverGroup.INSTANCE);
b.handler(new ChannelInitializer<SocketChannel>() { b.handler(new ChannelInitializer<SocketChannel>() {
@Override @Override
protected void initChannel(SocketChannel ch) throws Exception { protected void initChannel(SocketChannel ch) throws Exception {
@ -613,6 +616,7 @@ public class ProxyHandlerTest {
Bootstrap b = new Bootstrap(); Bootstrap b = new Bootstrap();
b.group(group); b.group(group);
b.channel(NioSocketChannel.class); b.channel(NioSocketChannel.class);
b.resolver(NoopNameResolverGroup.INSTANCE);
b.handler(new ChannelInitializer<SocketChannel>() { b.handler(new ChannelInitializer<SocketChannel>() {
@Override @Override
protected void initChannel(SocketChannel ch) throws Exception { protected void initChannel(SocketChannel ch) throws Exception {