diff --git a/dd-java-agent/instrumentation/netty-3.8/src/latestDepTest/groovy/Netty38ServerTest.groovy b/dd-java-agent/instrumentation/netty-3.8/src/latestDepTest/groovy/Netty38ServerTest.groovy index 4416f948db..a3c300699c 100644 --- a/dd-java-agent/instrumentation/netty-3.8/src/latestDepTest/groovy/Netty38ServerTest.groovy +++ b/dd-java-agent/instrumentation/netty-3.8/src/latestDepTest/groovy/Netty38ServerTest.groovy @@ -3,9 +3,9 @@ import datadog.trace.instrumentation.netty38.server.NettyHttpServerDecorator import org.jboss.netty.bootstrap.ServerBootstrap import org.jboss.netty.buffer.ChannelBuffer import org.jboss.netty.buffer.ChannelBuffers -import org.jboss.netty.channel.Channel import org.jboss.netty.channel.ChannelHandlerContext import org.jboss.netty.channel.ChannelPipeline +import org.jboss.netty.channel.ChannelPipelineFactory import org.jboss.netty.channel.DefaultChannelPipeline import org.jboss.netty.channel.DownstreamMessageEvent import org.jboss.netty.channel.ExceptionEvent @@ -35,7 +35,7 @@ import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.LOCATION import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1 -class Netty38ServerTest extends HttpServerTest { +class Netty38ServerTest extends HttpServerTest { ChannelPipeline channelPipeline() { ChannelPipeline channelPipeline = new DefaultChannelPipeline() @@ -107,18 +107,24 @@ class Netty38ServerTest extends HttpServerTest { } @Override - Channel startServer(int port) { + ServerBootstrap startServer(int port) { ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory()) bootstrap.setParentHandler(new LoggingHandler(InternalLogLevel.INFO)) - bootstrap.setPipeline(channelPipeline()) + bootstrap.setPipelineFactory(new ChannelPipelineFactory() { + @Override + ChannelPipeline getPipeline() throws Exception { + return channelPipeline() + } + }) InetSocketAddress address = new InetSocketAddress(port) - return bootstrap.bind(address) + bootstrap.bind(address) + return bootstrap } @Override - void stopServer(Channel server) { - server?.disconnect() + void stopServer(ServerBootstrap server) { + server?.shutdown() } @Override diff --git a/dd-java-agent/instrumentation/netty-3.8/src/test/groovy/Netty38ServerTest.groovy b/dd-java-agent/instrumentation/netty-3.8/src/test/groovy/Netty38ServerTest.groovy index 3d4982e1b1..7c1ba007e0 100644 --- a/dd-java-agent/instrumentation/netty-3.8/src/test/groovy/Netty38ServerTest.groovy +++ b/dd-java-agent/instrumentation/netty-3.8/src/test/groovy/Netty38ServerTest.groovy @@ -3,9 +3,9 @@ import datadog.trace.instrumentation.netty38.server.NettyHttpServerDecorator import org.jboss.netty.bootstrap.ServerBootstrap import org.jboss.netty.buffer.ChannelBuffer import org.jboss.netty.buffer.ChannelBuffers -import org.jboss.netty.channel.Channel import org.jboss.netty.channel.ChannelHandlerContext import org.jboss.netty.channel.ChannelPipeline +import org.jboss.netty.channel.ChannelPipelineFactory import org.jboss.netty.channel.DefaultChannelPipeline import org.jboss.netty.channel.DownstreamMessageEvent import org.jboss.netty.channel.ExceptionEvent @@ -35,7 +35,7 @@ import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.LOCATION import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1 -class Netty38ServerTest extends HttpServerTest { +class Netty38ServerTest extends HttpServerTest { ChannelPipeline channelPipeline() { ChannelPipeline channelPipeline = new DefaultChannelPipeline() @@ -107,18 +107,24 @@ class Netty38ServerTest extends HttpServerTest { } @Override - Channel startServer(int port) { + ServerBootstrap startServer(int port) { ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory()) bootstrap.setParentHandler(new LoggingHandler(InternalLogLevel.INFO)) - bootstrap.setPipeline(channelPipeline()) + bootstrap.setPipelineFactory(new ChannelPipelineFactory() { + @Override + ChannelPipeline getPipeline() throws Exception { + return channelPipeline() + } + }) InetSocketAddress address = new InetSocketAddress(port) - return bootstrap.bind(address) + bootstrap.bind(address) + return bootstrap } @Override - void stopServer(Channel server) { - server?.disconnect() + void stopServer(ServerBootstrap server) { + server?.shutdown() } @Override