This JUnit 5 extension detects resource leaks by registering a Netty LeakListener
import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(NettyLeakDetectorExtension.class)
class FooTest {
@Test
void testSomething() {
// ...
}
}
<dependency>
<groupId>io.github.nettyplus</groupId>
<artifactId>netty-leak-detector-junit-extension</artifactId>
<version>0.2.0</version>
<scope>test</scope>
</dependency>
This library was discussed in the following presentations:
- 2024: Chicago Java User Group
- 2025: ConFoo Montreal