diff --git a/client/pom.xml b/client/pom.xml index 039e5d662..7a28070c4 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -96,6 +96,12 @@ test + + io.github.nettyplus + netty-leak-detector-junit-extension + test + + org.eclipse.jetty jetty-servlet diff --git a/client/src/test/java/org/asynchttpclient/AbstractBasicTest.java b/client/src/test/java/org/asynchttpclient/AbstractBasicTest.java index f556d7486..993f87905 100644 --- a/client/src/test/java/org/asynchttpclient/AbstractBasicTest.java +++ b/client/src/test/java/org/asynchttpclient/AbstractBasicTest.java @@ -15,6 +15,7 @@ */ package org.asynchttpclient; +import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension; import org.asynchttpclient.test.EchoHandler; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; @@ -24,12 +25,14 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtendWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static org.asynchttpclient.test.TestUtils.addHttpConnector; @TestInstance(TestInstance.Lifecycle.PER_CLASS) +@ExtendWith(NettyLeakDetectorExtension.class) public abstract class AbstractBasicTest { protected static final Logger logger = LoggerFactory.getLogger(AbstractBasicTest.class); protected static final int TIMEOUT = 30; diff --git a/client/src/test/java/org/asynchttpclient/netty/NettyConnectionResetByPeerTest.java b/client/src/test/java/org/asynchttpclient/netty/NettyConnectionResetByPeerTest.java index a315017a1..484b074a3 100644 --- a/client/src/test/java/org/asynchttpclient/netty/NettyConnectionResetByPeerTest.java +++ b/client/src/test/java/org/asynchttpclient/netty/NettyConnectionResetByPeerTest.java @@ -16,11 +16,13 @@ package org.asynchttpclient.netty; import io.github.artsok.RepeatedIfExceptionsTest; +import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension; import org.asynchttpclient.AsyncHttpClient; import org.asynchttpclient.DefaultAsyncHttpClient; import org.asynchttpclient.DefaultAsyncHttpClientConfig; import org.asynchttpclient.RequestBuilder; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.ExtendWith; import java.io.IOException; import java.io.InputStream; @@ -34,6 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertInstanceOf; +@ExtendWith(NettyLeakDetectorExtension.class) public class NettyConnectionResetByPeerTest { private String resettingServerAddress; diff --git a/client/src/test/java/org/asynchttpclient/testserver/HttpTest.java b/client/src/test/java/org/asynchttpclient/testserver/HttpTest.java index 44d31269f..b41b6ab1b 100644 --- a/client/src/test/java/org/asynchttpclient/testserver/HttpTest.java +++ b/client/src/test/java/org/asynchttpclient/testserver/HttpTest.java @@ -15,15 +15,18 @@ */ package org.asynchttpclient.testserver; +import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension; import org.asynchttpclient.AsyncHttpClient; import org.asynchttpclient.AsyncHttpClientConfig; import org.asynchttpclient.DefaultAsyncHttpClientConfig; +import org.junit.jupiter.api.extension.ExtendWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static org.asynchttpclient.Dsl.asyncHttpClient; import static org.asynchttpclient.Dsl.config; +@ExtendWith(NettyLeakDetectorExtension.class) public abstract class HttpTest { protected static final String COMPLETED_EVENT = "Completed"; diff --git a/pom.xml b/pom.xml index 7fa222947..1e50f5d0c 100644 --- a/pom.xml +++ b/pom.xml @@ -112,6 +112,11 @@ pom import + + io.github.nettyplus + netty-leak-detector-junit-extension + 0.0.2 +