diff --git a/testsuite/pom.xml b/testsuite/pom.xml
index 3fbc9848e9..316866e7c0 100644
--- a/testsuite/pom.xml
+++ b/testsuite/pom.xml
@@ -89,6 +89,11 @@
junit-jupiter-engine
compile
+
+ org.junit.jupiter
+ junit-jupiter-params
+ compile
+
org.junit.vintage
junit-vintage-engine
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/AbstractComboTestsuiteTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/AbstractComboTestsuiteTest.java
index c7bf21ad44..16318ed804 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/AbstractComboTestsuiteTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/AbstractComboTestsuiteTest.java
@@ -21,37 +21,25 @@ import io.netty.testsuite.util.TestUtils;
import io.netty.util.internal.StringUtil;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
-import org.junit.Rule;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.TestInfo;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.List;
public abstract class AbstractComboTestsuiteTest,
CB extends AbstractBootstrap, ?>> {
- private final Class sbClazz;
- private final Class cbClazz;
protected final InternalLogger logger = InternalLoggerFactory.getInstance(getClass());
protected volatile CB cb;
protected volatile SB sb;
- protected AbstractComboTestsuiteTest(Class sbClazz, Class cbClazz) {
- this.sbClazz = sbClazz;
- this.cbClazz = cbClazz;
- }
-
protected abstract List> newFactories();
protected List newAllocators() {
return TestsuitePermutation.allocator();
}
- @Rule
- public final TestName testName = new TestName();
-
- protected void run() throws Throwable {
+ protected void run(TestInfo testInfo, Runner runner) throws Throwable {
List> combos = newFactories();
+ String methodName = TestUtils.testMethodName(testInfo);
for (ByteBufAllocator allocator: newAllocators()) {
int i = 0;
for (TestsuitePermutation.BootstrapComboFactory e: combos) {
@@ -60,17 +48,15 @@ public abstract class AbstractComboTestsuiteTest, CB extends AbstractBootstrap, ?>> {
+ void run(SB sb, CB cb) throws Throwable;
+ }
}
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java
index 7c72d64958..21778c1fa2 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java
@@ -15,18 +15,6 @@
*/
package io.netty.testsuite.transport;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Test;
-
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
@@ -39,10 +27,22 @@ import io.netty.channel.local.LocalAddress;
import io.netty.channel.local.LocalServerChannel;
import io.netty.util.concurrent.EventExecutor;
import io.netty.util.concurrent.Future;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public abstract class AbstractSingleThreadEventLoopTest {
- @Test(timeout = 5000)
+ @Timeout(value = 5000, unit = TimeUnit.MILLISECONDS)
public void testChannelsRegistered() throws Exception {
EventLoopGroup group = newEventLoopGroup();
final SingleThreadEventLoop loop = (SingleThreadEventLoop) group.next();
@@ -106,7 +106,8 @@ public abstract class AbstractSingleThreadEventLoopTest {
}
// Copied from AbstractEventLoopTest
- @Test(timeout = 5000)
+ @Test
+ @Timeout(value = 5000, unit = TimeUnit.MILLISECONDS)
public void testShutdownGracefullyNoQuietPeriod() throws Exception {
EventLoopGroup loop = newEventLoopGroup();
ServerBootstrap b = new ServerBootstrap();
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/AbstractTestsuiteTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/AbstractTestsuiteTest.java
index 9a7e1cba6b..9f912b78fa 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/AbstractTestsuiteTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/AbstractTestsuiteTest.java
@@ -21,33 +21,23 @@ import io.netty.testsuite.util.TestUtils;
import io.netty.util.internal.StringUtil;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
-import org.junit.Rule;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.TestInfo;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.List;
public abstract class AbstractTestsuiteTest> {
- private final Class clazz;
protected final InternalLogger logger = InternalLoggerFactory.getInstance(getClass());
protected volatile T cb;
- protected AbstractTestsuiteTest(Class clazz) {
- this.clazz = clazz;
- }
-
protected abstract List> newFactories();
protected List newAllocators() {
return TestsuitePermutation.allocator();
}
- @Rule
- public final TestName testName = new TestName();
-
- protected void run() throws Throwable {
+ protected void run(TestInfo testInfo, Runner runner) throws Throwable {
List> combos = newFactories();
+ String methodName = TestUtils.testMethodName(testInfo);
for (ByteBufAllocator allocator: newAllocators()) {
int i = 0;
for (TestsuitePermutation.BootstrapFactory e: combos) {
@@ -55,17 +45,15 @@ public abstract class AbstractTestsuiteTest> {
configure(cb, allocator);
logger.info(String.format(
"Running: %s %d of %d with %s",
- testName.getMethodName(), ++ i, combos.size(), StringUtil.simpleClassName(allocator)));
- try {
- Method m = getClass().getMethod(
- TestUtils.testMethodName(testName), clazz);
- m.invoke(this, cb);
- } catch (InvocationTargetException ex) {
- throw ex.getCause();
- }
+ methodName, ++ i, combos.size(), StringUtil.simpleClassName(allocator)));
+ runner.run(cb);
}
}
}
protected abstract void configure(T bootstrap, ByteBufAllocator allocator);
+
+ public interface Runner> {
+ void run(CB cb) throws Throwable;
+ }
}
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/sctp/AbstractSctpTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/sctp/AbstractSctpTest.java
index 26f48924f2..4bde9a181a 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/sctp/AbstractSctpTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/sctp/AbstractSctpTest.java
@@ -27,11 +27,6 @@ import java.net.InetSocketAddress;
import java.util.List;
public abstract class AbstractSctpTest extends AbstractComboTestsuiteTest {
-
- protected AbstractSctpTest() {
- super(ServerBootstrap.class, Bootstrap.class);
- }
-
@Override
protected List> newFactories() {
return SctpTestPermutation.sctpChannel();
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java
index f17dcf0181..229ef02a63 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java
@@ -28,14 +28,15 @@ import io.netty.handler.codec.sctp.SctpInboundByteStreamHandler;
import io.netty.handler.codec.sctp.SctpMessageCompletionHandler;
import io.netty.handler.codec.sctp.SctpOutboundByteStreamHandler;
import io.netty.testsuite.util.TestUtils;
-import org.junit.Assume;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Random;
import java.util.concurrent.atomic.AtomicReference;
+import org.junit.jupiter.api.TestInfo;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class SctpEchoTest extends AbstractSctpTest {
@@ -47,9 +48,14 @@ public class SctpEchoTest extends AbstractSctpTest {
}
@Test
- public void testSimpleEcho() throws Throwable {
- Assume.assumeTrue(TestUtils.isSctpSupported());
- run();
+ public void testSimpleEcho(TestInfo testInfo) throws Throwable {
+ assumeTrue(TestUtils.isSctpSupported());
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testSimpleEcho(serverBootstrap, bootstrap);
+ }
+ });
}
public void testSimpleEcho(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -57,9 +63,14 @@ public class SctpEchoTest extends AbstractSctpTest {
}
@Test
- public void testSimpleEchoUnordered() throws Throwable {
- Assume.assumeTrue(TestUtils.isSctpSupported());
- run();
+ public void testSimpleEchoUnordered(TestInfo testInfo) throws Throwable {
+ assumeTrue(TestUtils.isSctpSupported());
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testSimpleEchoUnordered(serverBootstrap, bootstrap);
+ }
+ });
}
public void testSimpleEchoUnordered(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractClientSocketTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractClientSocketTest.java
index a99ca35e22..765e96f8dc 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractClientSocketTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractClientSocketTest.java
@@ -27,11 +27,6 @@ import java.net.SocketAddress;
import java.util.List;
public abstract class AbstractClientSocketTest extends AbstractTestsuiteTest {
-
- protected AbstractClientSocketTest() {
- super(Bootstrap.class);
- }
-
@Override
protected List> newFactories() {
return SocketTestPermutation.INSTANCE.clientSocket();
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractDatagramTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractDatagramTest.java
index 2076358120..319242fbae 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractDatagramTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractDatagramTest.java
@@ -28,11 +28,6 @@ import java.net.SocketAddress;
import java.util.List;
public abstract class AbstractDatagramTest extends AbstractComboTestsuiteTest {
-
- protected AbstractDatagramTest() {
- super(Bootstrap.class, Bootstrap.class);
- }
-
@Override
protected List> newFactories() {
return SocketTestPermutation.INSTANCE.datagram(socketInternetProtocalFamily());
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractServerSocketTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractServerSocketTest.java
index defa1aeb76..02330462d1 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractServerSocketTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractServerSocketTest.java
@@ -28,10 +28,6 @@ import java.util.List;
public abstract class AbstractServerSocketTest extends AbstractTestsuiteTest {
- protected AbstractServerSocketTest() {
- super(ServerBootstrap.class);
- }
-
@Override
protected List> newFactories() {
return SocketTestPermutation.INSTANCE.serverSocket();
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketReuseFdTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketReuseFdTest.java
index acd8ceff1e..abd7261d54 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketReuseFdTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketReuseFdTest.java
@@ -30,11 +30,14 @@ import io.netty.testsuite.transport.TestsuitePermutation;
import io.netty.util.CharsetUtil;
import io.netty.util.concurrent.ImmediateEventExecutor;
import io.netty.util.concurrent.Promise;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.io.IOException;
import java.net.SocketAddress;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@@ -45,9 +48,15 @@ public abstract class AbstractSocketReuseFdTest extends AbstractSocketTest {
@Override
protected abstract List> newFactories();
- @Test(timeout = 60000)
- public void testReuseFd() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS)
+ public void testReuseFd(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testReuseFd(serverBootstrap, bootstrap);
+ }
+ });
}
public void testReuseFd(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketShutdownOutputByPeerTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketShutdownOutputByPeerTest.java
index cb125c9015..e3d2f675df 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketShutdownOutputByPeerTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketShutdownOutputByPeerTest.java
@@ -23,22 +23,33 @@ import io.netty.channel.ChannelOption;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.socket.ChannelInputShutdownEvent;
import io.netty.channel.socket.DuplexChannel;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.io.IOException;
import java.net.SocketAddress;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public abstract class AbstractSocketShutdownOutputByPeerTest extends AbstractServerSocketTest {
- @Test(timeout = 30000)
- public void testShutdownOutput() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testShutdownOutput(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap) throws Throwable {
+ testShutdownOutput(serverBootstrap);
+ }
+ });
}
public void testShutdownOutput(ServerBootstrap sb) throws Throwable {
@@ -78,9 +89,15 @@ public abstract class AbstractSocketShutdownOutputByPeerTest extends Abs
}
}
- @Test(timeout = 30000)
- public void testShutdownOutputWithoutOption() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testShutdownOutputWithoutOption(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap) throws Throwable {
+ testShutdownOutputWithoutOption(serverBootstrap);
+ }
+ });
}
public void testShutdownOutputWithoutOption(ServerBootstrap sb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketTest.java
index 2cfaf34066..5c2f41acab 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketTest.java
@@ -28,11 +28,6 @@ import java.net.SocketAddress;
import java.util.List;
public abstract class AbstractSocketTest extends AbstractComboTestsuiteTest {
-
- protected AbstractSocketTest() {
- super(ServerBootstrap.class, Bootstrap.class);
- }
-
@Override
protected List> newFactories() {
return SocketTestPermutation.INSTANCE.socket();
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/CompositeBufferGatheringWriteTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/CompositeBufferGatheringWriteTest.java
index 380771df9f..67bac1a136 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/CompositeBufferGatheringWriteTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/CompositeBufferGatheringWriteTest.java
@@ -28,21 +28,30 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.util.ReferenceCountUtil;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.io.IOException;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class CompositeBufferGatheringWriteTest extends AbstractSocketTest {
private static final int EXPECTED_BYTES = 20;
- @Test(timeout = 10000)
- public void testSingleCompositeBufferWrite() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 10000, unit = TimeUnit.MILLISECONDS)
+ public void testSingleCompositeBufferWrite(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testSingleCompositeBufferWrite(serverBootstrap, bootstrap);
+ }
+ });
}
public void testSingleCompositeBufferWrite(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -136,9 +145,15 @@ public class CompositeBufferGatheringWriteTest extends AbstractSocketTest {
}
}
- @Test(timeout = 10000)
- public void testCompositeBufferPartialWriteDoesNotCorruptData() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 10000, unit = TimeUnit.MILLISECONDS)
+ public void testCompositeBufferPartialWriteDoesNotCorruptData(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testCompositeBufferPartialWriteDoesNotCorruptData(serverBootstrap, bootstrap);
+ }
+ });
}
protected void compositeBufferPartialWriteDoesNotCorruptDataInitServerConfig(ChannelConfig config,
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramConnectNotExistsTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramConnectNotExistsTest.java
index 82323b2e3f..4e8cc350f9 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramConnectNotExistsTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramConnectNotExistsTest.java
@@ -28,12 +28,16 @@ import io.netty.util.NetUtil;
import io.netty.util.concurrent.ImmediateEventExecutor;
import io.netty.util.concurrent.Promise;
import io.netty.util.internal.PlatformDependent;
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.net.PortUnreachableException;
import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
public class DatagramConnectNotExistsTest extends AbstractClientSocketTest {
@@ -42,15 +46,21 @@ public class DatagramConnectNotExistsTest extends AbstractClientSocketTest {
return SocketTestPermutation.INSTANCE.datagramSocket();
}
- @Test(timeout = 10000)
- public void testConnectNotExists() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 10000, unit = TimeUnit.MILLISECONDS)
+ public void testConnectNotExists(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap) {
+ testConnectNotExists(bootstrap);
+ }
+ });
}
- public void testConnectNotExists(Bootstrap cb) throws Throwable {
+ public void testConnectNotExists(Bootstrap cb) {
// Currently not works on windows
// See https://github.com/netty/netty/issues/11285
- Assume.assumeFalse(PlatformDependent.isWindows());
+ assumeFalse(PlatformDependent.isWindows());
final Promise promise = ImmediateEventExecutor.INSTANCE.newPromise();
cb.handler(new ChannelInboundHandlerAdapter() {
@Override
@@ -61,11 +71,11 @@ public class DatagramConnectNotExistsTest extends AbstractClientSocketTest {
ChannelFuture future = cb.connect(NetUtil.LOCALHOST, SocketTestPermutation.BAD_PORT);
try {
Channel datagramChannel = future.syncUninterruptibly().channel();
- Assert.assertTrue(datagramChannel.isActive());
+ assertTrue(datagramChannel.isActive());
datagramChannel.writeAndFlush(
Unpooled.copiedBuffer("test", CharsetUtil.US_ASCII)).syncUninterruptibly();
if (!(datagramChannel instanceof OioDatagramChannel)) {
- Assert.assertTrue(promise.syncUninterruptibly().getNow() instanceof PortUnreachableException);
+ assertTrue(promise.syncUninterruptibly().getNow() instanceof PortUnreachableException);
}
} finally {
future.channel().close();
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastIPv6Test.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastIPv6Test.java
index 50da76941d..49b7c126da 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastIPv6Test.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastIPv6Test.java
@@ -18,7 +18,8 @@ package io.netty.testsuite.transport.socket;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.socket.InternetProtocolFamily;
import io.netty.util.internal.PlatformDependent;
-import org.junit.Assume;
+
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
public class DatagramMulticastIPv6Test extends DatagramMulticastTest {
@@ -26,7 +27,7 @@ public class DatagramMulticastIPv6Test extends DatagramMulticastTest {
public void testMulticast(Bootstrap sb, Bootstrap cb) throws Throwable {
// Not works on windows atm.
// See https://github.com/netty/netty/issues/11285
- Assume.assumeFalse(PlatformDependent.isWindows());
+ assumeFalse(PlatformDependent.isWindows());
super.testMulticast(sb, cb);
}
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastTest.java
index 95a9c43373..f22b50b1ca 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastTest.java
@@ -26,8 +26,8 @@ import io.netty.channel.socket.InternetProtocolFamily;
import io.netty.channel.socket.oio.OioDatagramChannel;
import io.netty.testsuite.transport.TestsuitePermutation;
import io.netty.util.internal.SocketUtils;
-import org.junit.Assume;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import java.io.IOException;
import java.net.InetAddress;
@@ -40,19 +40,28 @@ import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class DatagramMulticastTest extends AbstractDatagramTest {
@Test
- public void testMulticast() throws Throwable {
- run();
+ public void testMulticast(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap, Bootstrap bootstrap2) throws Throwable {
+ testMulticast(bootstrap, bootstrap2);
+ }
+ });
}
public void testMulticast(Bootstrap sb, Bootstrap cb) throws Throwable {
NetworkInterface iface = multicastNetworkInterface();
- Assume.assumeNotNull("No NetworkInterface found that supports multicast and " +
- socketInternetProtocalFamily(), iface);
+ assumeTrue(iface != null, "No NetworkInterface found that supports multicast and " +
+ socketInternetProtocalFamily());
MulticastTestHandler mhandler = new MulticastTestHandler();
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastIPv6Test.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastIPv6Test.java
index 10f804ed47..bb43a96a40 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastIPv6Test.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastIPv6Test.java
@@ -19,7 +19,7 @@ import io.netty.channel.socket.InternetProtocolFamily;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.SuppressJava6Requirement;
import org.junit.Assume;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.BeforeAll;
import java.io.IOException;
import java.net.StandardProtocolFamily;
@@ -29,7 +29,7 @@ import java.nio.channels.spi.SelectorProvider;
public class DatagramUnicastIPv6Test extends DatagramUnicastTest {
@SuppressJava6Requirement(reason = "Guarded by java version check")
- @BeforeClass
+ @BeforeAll
public static void assumeIpv6Supported() {
try {
if (PlatformDependent.javaVersion() < 7) {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastTest.java
index c6fb810bf8..4a77c4c1ea 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastTest.java
@@ -29,7 +29,8 @@ import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.socket.DatagramChannel;
import io.netty.channel.socket.DatagramPacket;
import io.netty.util.NetUtil;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import java.net.Inet6Address;
import java.net.InetAddress;
@@ -42,7 +43,12 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public class DatagramUnicastTest extends AbstractDatagramTest {
@@ -52,8 +58,13 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
}
@Test
- public void testBindWithPortOnly() throws Throwable {
- run();
+ public void testBindWithPortOnly(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap, Bootstrap bootstrap2) throws Throwable {
+ testBindWithPortOnly(bootstrap, bootstrap2);
+ }
+ });
}
public void testBindWithPortOnly(Bootstrap sb, Bootstrap cb) throws Throwable {
@@ -67,8 +78,13 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
}
@Test
- public void testSimpleSendDirectByteBuf() throws Throwable {
- run();
+ public void testSimpleSendDirectByteBuf(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap, Bootstrap bootstrap2) throws Throwable {
+ testSimpleSendDirectByteBuf(bootstrap, bootstrap2);
+ }
+ });
}
public void testSimpleSendDirectByteBuf(Bootstrap sb, Bootstrap cb) throws Throwable {
@@ -77,8 +93,13 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
}
@Test
- public void testSimpleSendHeapByteBuf() throws Throwable {
- run();
+ public void testSimpleSendHeapByteBuf(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap, Bootstrap bootstrap2) throws Throwable {
+ testSimpleSendHeapByteBuf(bootstrap, bootstrap2);
+ }
+ });
}
public void testSimpleSendHeapByteBuf(Bootstrap sb, Bootstrap cb) throws Throwable {
@@ -87,8 +108,13 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
}
@Test
- public void testSimpleSendCompositeDirectByteBuf() throws Throwable {
- run();
+ public void testSimpleSendCompositeDirectByteBuf(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap, Bootstrap bootstrap2) throws Throwable {
+ testSimpleSendCompositeDirectByteBuf(bootstrap, bootstrap2);
+ }
+ });
}
public void testSimpleSendCompositeDirectByteBuf(Bootstrap sb, Bootstrap cb) throws Throwable {
@@ -104,8 +130,13 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
}
@Test
- public void testSimpleSendCompositeHeapByteBuf() throws Throwable {
- run();
+ public void testSimpleSendCompositeHeapByteBuf(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap, Bootstrap bootstrap2) throws Throwable {
+ testSimpleSendCompositeHeapByteBuf(bootstrap, bootstrap2);
+ }
+ });
}
public void testSimpleSendCompositeHeapByteBuf(Bootstrap sb, Bootstrap cb) throws Throwable {
@@ -121,8 +152,13 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
}
@Test
- public void testSimpleSendCompositeMixedByteBuf() throws Throwable {
- run();
+ public void testSimpleSendCompositeMixedByteBuf(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap, Bootstrap bootstrap2) throws Throwable {
+ testSimpleSendCompositeMixedByteBuf(bootstrap, bootstrap2);
+ }
+ });
}
public void testSimpleSendCompositeMixedByteBuf(Bootstrap sb, Bootstrap cb) throws Throwable {
@@ -138,8 +174,13 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
}
@Test
- public void testSimpleSendWithoutBind() throws Throwable {
- run();
+ public void testSimpleSendWithoutBind(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap, Bootstrap bootstrap2) throws Throwable {
+ testSimpleSendWithoutBind(bootstrap, bootstrap2);
+ }
+ });
}
public void testSimpleSendWithoutBind(Bootstrap sb, Bootstrap cb) throws Throwable {
@@ -156,8 +197,13 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
}
@Test
- public void testSimpleSendWithConnect() throws Throwable {
- run();
+ public void testSimpleSendWithConnect(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap, Bootstrap bootstrap2) throws Throwable {
+ testSimpleSendWithConnect(bootstrap, bootstrap2);
+ }
+ });
}
public void testSimpleSendWithConnect(Bootstrap sb, Bootstrap cb) throws Throwable {
@@ -325,8 +371,8 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
ChannelFuture future = cc.writeAndFlush(
buf.retain().duplicate()).awaitUninterruptibly();
- assertTrue("NotYetConnectedException expected, got: " + future.cause(),
- future.cause() instanceof NotYetConnectedException);
+ assertTrue(future.cause() instanceof NotYetConnectedException,
+ "NotYetConnectedException expected, got: " + future.cause());
} finally {
// release as we used buf.retain() before
buf.release();
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/ServerSocketSuspendTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/ServerSocketSuspendTest.java
index 051d598cf1..db88ed82b0 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/ServerSocketSuspendTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/ServerSocketSuspendTest.java
@@ -22,15 +22,16 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelOption;
import io.netty.util.internal.SocketUtils;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class ServerSocketSuspendTest extends AbstractServerSocketTest {
@@ -38,9 +39,14 @@ public class ServerSocketSuspendTest extends AbstractServerSocketTest {
private static final long TIMEOUT = 3000000000L;
@Test
- @Ignore("Need to investigate why it fails on osx")
- public void testSuspendAndResumeAccept() throws Throwable {
- run();
+ @Disabled("Need to investigate why it fails on osx")
+ public void testSuspendAndResumeAccept(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap) throws Throwable {
+ testSuspendAndResumeAccept(serverBootstrap);
+ }
+ });
}
public void testSuspendAndResumeAccept(ServerBootstrap sb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketAutoReadTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketAutoReadTest.java
index f630615bcd..882aec42d6 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketAutoReadTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketAutoReadTest.java
@@ -29,19 +29,25 @@ import io.netty.channel.ChannelOption;
import io.netty.channel.RecvByteBufAllocator;
import io.netty.util.ReferenceCountUtil;
import io.netty.util.UncheckedBooleanSupplier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SocketAutoReadTest extends AbstractSocketTest {
@Test
- public void testAutoReadOffDuringReadOnlyReadsOneTime() throws Throwable {
- run();
+ public void testAutoReadOffDuringReadOnlyReadsOneTime(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testAutoReadOffDuringReadOnlyReadsOneTime(serverBootstrap, bootstrap);
+ }
+ });
}
public void testAutoReadOffDuringReadOnlyReadsOneTime(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketBufReleaseTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketBufReleaseTest.java
index 5b5d90ce7b..11f9299e16 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketBufReleaseTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketBufReleaseTest.java
@@ -28,12 +28,13 @@ import io.netty.util.concurrent.DefaultPromise;
import io.netty.util.concurrent.DefaultThreadFactory;
import io.netty.util.concurrent.EventExecutor;
import io.netty.util.concurrent.Promise;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class SocketBufReleaseTest extends AbstractSocketTest {
@@ -41,8 +42,13 @@ public class SocketBufReleaseTest extends AbstractSocketTest {
new DefaultEventExecutorGroup(1, new DefaultThreadFactory(SocketBufReleaseTest.class, true)).next();
@Test
- public void testBufRelease() throws Throwable {
- run();
+ public void testBufRelease(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testBufRelease(serverBootstrap, bootstrap);
+ }
+ });
}
public void testBufRelease(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketCancelWriteTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketCancelWriteTest.java
index b02d2b8c24..9a775227b0 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketCancelWriteTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketCancelWriteTest.java
@@ -23,19 +23,28 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
-import org.junit.Test;
+import java.util.concurrent.TimeUnit;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicReference;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SocketCancelWriteTest extends AbstractSocketTest {
- @Test(timeout = 30000)
- public void testCancelWrite() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testCancelWrite(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testCancelWrite(serverBootstrap, bootstrap);
+ }
+ });
}
public void testCancelWrite(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketChannelNotYetConnectedTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketChannelNotYetConnectedTest.java
index 33be92ca20..ea32b86e57 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketChannelNotYetConnectedTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketChannelNotYetConnectedTest.java
@@ -18,17 +18,26 @@ package io.netty.testsuite.transport.socket;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.socket.SocketChannel;
-import org.junit.Test;
+import java.util.concurrent.TimeUnit;
+import org.junit.jupiter.api.Test;
import java.net.SocketException;
import java.nio.channels.NotYetConnectedException;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
public class SocketChannelNotYetConnectedTest extends AbstractClientSocketTest {
- @Test(timeout = 30000)
- public void testShutdownNotYetConnected() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testShutdownNotYetConnected(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap) throws Throwable {
+ testShutdownNotYetConnected(bootstrap);
+ }
+ });
}
public void testShutdownNotYetConnected(Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketCloseForciblyTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketCloseForciblyTest.java
index 194141f0aa..bd50b23fa6 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketCloseForciblyTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketCloseForciblyTest.java
@@ -21,13 +21,19 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.socket.SocketChannel;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
public class SocketCloseForciblyTest extends AbstractSocketTest {
@Test
- public void testCloseForcibly() throws Throwable {
- run();
+ public void testCloseForcibly(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testCloseForcibly(serverBootstrap, bootstrap);
+ }
+ });
}
public void testCloseForcibly(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConditionalWritabilityTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConditionalWritabilityTest.java
index 0c218aa5c5..2c6bb4a79e 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConditionalWritabilityTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConditionalWritabilityTest.java
@@ -26,14 +26,23 @@ import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.WriteBufferWaterMark;
import io.netty.util.ReferenceCountUtil;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
public class SocketConditionalWritabilityTest extends AbstractSocketTest {
- @Test(timeout = 30000)
- public void testConditionalWritability() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testConditionalWritability(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testConditionalWritability(serverBootstrap, bootstrap);
+ }
+ });
}
public void testConditionalWritability(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConnectTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConnectTest.java
index 912cda338f..9b306b53e1 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConnectTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConnectTest.java
@@ -29,8 +29,10 @@ import io.netty.channel.socket.SocketChannel;
import io.netty.util.concurrent.ImmediateEventExecutor;
import io.netty.util.concurrent.Promise;
import io.netty.util.internal.StringUtil;
-import org.junit.AssumptionViolatedException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
+import org.opentest4j.TestAbortedException;
import java.io.ByteArrayOutputStream;
import java.net.InetSocketAddress;
@@ -38,21 +40,28 @@ import java.net.SocketAddress;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
import static io.netty.buffer.ByteBufUtil.writeAscii;
import static io.netty.buffer.UnpooledByteBufAllocator.DEFAULT;
import static io.netty.util.CharsetUtil.US_ASCII;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SocketConnectTest extends AbstractSocketTest {
- @Test(timeout = 30000)
- public void testLocalAddressAfterConnect() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testLocalAddressAfterConnect(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testLocalAddressAfterConnect(serverBootstrap, bootstrap);
+ }
+ });
}
public void testLocalAddressAfterConnect(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -87,9 +96,15 @@ public class SocketConnectTest extends AbstractSocketTest {
}
}
- @Test(timeout = 3000)
- public void testChannelEventsFiredWhenClosedDirectly() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
+ public void testChannelEventsFiredWhenClosedDirectly(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testChannelEventsFiredWhenClosedDirectly(serverBootstrap, bootstrap);
+ }
+ });
}
public void testChannelEventsFiredWhenClosedDirectly(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -127,9 +142,15 @@ public class SocketConnectTest extends AbstractSocketTest {
}
}
- @Test(timeout = 3000)
- public void testWriteWithFastOpenBeforeConnect() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
+ public void testWriteWithFastOpenBeforeConnect(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testWriteWithFastOpenBeforeConnect(serverBootstrap, bootstrap);
+ }
+ });
}
public void testWriteWithFastOpenBeforeConnect(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -168,7 +189,7 @@ public class SocketConnectTest extends AbstractSocketTest {
}
protected void enableTcpFastOpen(ServerBootstrap sb, Bootstrap cb) {
- throw new AssumptionViolatedException(
+ throw new TestAbortedException(
"Support for testing TCP_FASTOPEN not enabled for " + StringUtil.simpleClassName(this));
}
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConnectionAttemptTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConnectionAttemptTest.java
index 0e117d5324..b253e4d4d8 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConnectionAttemptTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketConnectionAttemptTest.java
@@ -26,27 +26,36 @@ import io.netty.util.NetUtil;
import io.netty.util.concurrent.GlobalEventExecutor;
import io.netty.util.concurrent.Promise;
import io.netty.util.internal.logging.InternalLoggerFactory;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.io.IOException;
import java.net.ConnectException;
import java.net.Socket;
+import java.util.concurrent.TimeUnit;
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.*;
-import static org.junit.Assume.*;
import static io.netty.testsuite.transport.socket.SocketTestPermutation.BAD_HOST;
import static io.netty.testsuite.transport.socket.SocketTestPermutation.BAD_PORT;
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class SocketConnectionAttemptTest extends AbstractClientSocketTest {
// See /etc/services
private static final int UNASSIGNED_PORT = 4;
- @Test(timeout = 30000)
- public void testConnectTimeout() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testConnectTimeout(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap) throws Throwable {
+ testConnectTimeout(bootstrap);
+ }
+ });
}
public void testConnectTimeout(Bootstrap cb) throws Throwable {
@@ -59,18 +68,30 @@ public class SocketConnectionAttemptTest extends AbstractClientSocketTest {
}
}
- @Test(timeout = 30000)
- public void testConnectRefused() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testConnectRefused(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap) throws Throwable {
+ testConnectRefused(bootstrap);
+ }
+ });
}
public void testConnectRefused(Bootstrap cb) throws Throwable {
testConnectRefused0(cb, false);
}
- @Test(timeout = 30000)
- public void testConnectRefusedHalfClosure() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testConnectRefusedHalfClosure(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap) throws Throwable {
+ testConnectRefusedHalfClosure(bootstrap);
+ }
+ });
}
public void testConnectRefusedHalfClosure(Bootstrap cb) throws Throwable {
@@ -94,7 +115,7 @@ public class SocketConnectionAttemptTest extends AbstractClientSocketTest {
}
@Test
- public void testConnectCancellation() throws Throwable {
+ public void testConnectCancellation(TestInfo testInfo) throws Throwable {
// Check if the test can be executed or should be skipped because of no network/internet connection
// See https://github.com/netty/netty/issues/1474
boolean badHostTimedOut = true;
@@ -114,10 +135,14 @@ public class SocketConnectionAttemptTest extends AbstractClientSocketTest {
}
}
- assumeThat("The connection attempt to " + BAD_HOST + " does not time out.",
- badHostTimedOut, is(true));
+ assumeTrue(badHostTimedOut, "The connection attempt to " + BAD_HOST + " does not time out.");
- run();
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap) throws Throwable {
+ testConnectCancellation(bootstrap);
+ }
+ });
}
public void testConnectCancellation(Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketDataReadInitialStateTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketDataReadInitialStateTest.java
index 3b532d5f6d..17080426be 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketDataReadInitialStateTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketDataReadInitialStateTest.java
@@ -23,19 +23,28 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.SimpleChannelInboundHandler;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import static io.netty.channel.ChannelOption.AUTO_READ;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
public class SocketDataReadInitialStateTest extends AbstractSocketTest {
- @Test(timeout = 10000)
- public void testAutoReadOffNoDataReadUntilReadCalled() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 10000, unit = TimeUnit.MILLISECONDS)
+ public void testAutoReadOffNoDataReadUntilReadCalled(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testAutoReadOffNoDataReadUntilReadCalled(serverBootstrap, bootstrap);
+ }
+ });
}
public void testAutoReadOffNoDataReadUntilReadCalled(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -127,9 +136,15 @@ public class SocketDataReadInitialStateTest extends AbstractSocketTest {
}
}
- @Test(timeout = 10000)
- public void testAutoReadOnDataReadImmediately() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 10000, unit = TimeUnit.MILLISECONDS)
+ public void testAutoReadOnDataReadImmediately(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testAutoReadOnDataReadImmediately(serverBootstrap, bootstrap);
+ }
+ });
}
public void testAutoReadOnDataReadImmediately(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java
index 51bd5ac021..68f90c1242 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java
@@ -27,15 +27,20 @@ import io.netty.channel.ChannelOption;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.util.concurrent.DefaultEventExecutorGroup;
import io.netty.util.concurrent.EventExecutorGroup;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Random;
import java.util.concurrent.atomic.AtomicReference;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
public class SocketEchoTest extends AbstractSocketTest {
@@ -48,73 +53,111 @@ public class SocketEchoTest extends AbstractSocketTest {
random.nextBytes(data);
}
- @BeforeClass
+ @BeforeAll
public static void createGroup() {
group = new DefaultEventExecutorGroup(2);
}
- @AfterClass
+ @AfterAll
public static void destroyGroup() throws Exception {
group.shutdownGracefully().sync();
}
- @Test(timeout = 30000)
- public void testSimpleEcho() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testSimpleEcho(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testSimpleEcho(serverBootstrap, bootstrap);
+ }
+ });
}
public void testSimpleEcho(ServerBootstrap sb, Bootstrap cb) throws Throwable {
testSimpleEcho0(sb, cb, false, false, true);
}
- @Test(timeout = 30000)
- public void testSimpleEchoNotAutoRead() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testSimpleEchoNotAutoRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
+ testSimpleEchoNotAutoRead(sb1, cb1);
+ }
+ });
}
public void testSimpleEchoNotAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
testSimpleEcho0(sb, cb, false, false, false);
}
- @Test//(timeout = 30000)
- public void testSimpleEchoWithAdditionalExecutor() throws Throwable {
- run();
+ @Test
+ public void testSimpleEchoWithAdditionalExecutor(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
+ testSimpleEchoWithAdditionalExecutor(sb1, cb1);
+ }
+ });
}
public void testSimpleEchoWithAdditionalExecutor(ServerBootstrap sb, Bootstrap cb) throws Throwable {
testSimpleEcho0(sb, cb, true, false, true);
}
- @Test//(timeout = 30000)
- public void testSimpleEchoWithAdditionalExecutorNotAutoRead() throws Throwable {
- run();
+ @Test
+ public void testSimpleEchoWithAdditionalExecutorNotAutoRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
+ testSimpleEchoWithAdditionalExecutorNotAutoRead(sb1, cb1);
+ }
+ });
}
public void testSimpleEchoWithAdditionalExecutorNotAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
testSimpleEcho0(sb, cb, true, false, false);
}
- @Test//(timeout = 30000)
- public void testSimpleEchoWithVoidPromise() throws Throwable {
- run();
+ @Test
+ public void testSimpleEchoWithVoidPromise(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
+ testSimpleEchoWithVoidPromise(sb1, cb1);
+ }
+ });
}
public void testSimpleEchoWithVoidPromise(ServerBootstrap sb, Bootstrap cb) throws Throwable {
testSimpleEcho0(sb, cb, false, true, true);
}
- @Test//(timeout = 30000)
- public void testSimpleEchoWithVoidPromiseNotAutoRead() throws Throwable {
- run();
+ @Test
+ public void testSimpleEchoWithVoidPromiseNotAutoRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
+ testSimpleEchoWithVoidPromiseNotAutoRead(sb1, cb1);
+ }
+ });
}
public void testSimpleEchoWithVoidPromiseNotAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
testSimpleEcho0(sb, cb, false, true, false);
}
- @Test(timeout = 30000)
- public void testSimpleEchoWithAdditionalExecutorAndVoidPromise() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testSimpleEchoWithAdditionalExecutorAndVoidPromise(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
+ testSimpleEchoWithAdditionalExecutorAndVoidPromise(sb1, cb1);
+ }
+ });
}
public void testSimpleEchoWithAdditionalExecutorAndVoidPromise(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketExceptionHandlingTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketExceptionHandlingTest.java
index 670e8a3ff1..c611563267 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketExceptionHandlingTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketExceptionHandlingTest.java
@@ -25,19 +25,25 @@ import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
import io.netty.util.ReferenceCountUtil;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
+import org.junit.jupiter.api.TestInfo;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SocketExceptionHandlingTest extends AbstractSocketTest {
@Test
- public void testReadPendingIsResetAfterEachRead() throws Throwable {
- run();
+ public void testReadPendingIsResetAfterEachRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testReadPendingIsResetAfterEachRead(serverBootstrap, bootstrap);
+ }
+ });
}
public void testReadPendingIsResetAfterEachRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -59,9 +65,9 @@ public class SocketExceptionHandlingTest extends AbstractSocketTest {
assertTrue(serverInitializer.exceptionHandler.latch1.await(5, TimeUnit.SECONDS));
// After we get the first exception, we should get no more, this is expected to timeout.
- assertFalse("Encountered " + serverInitializer.exceptionHandler.count.get() +
- " exceptions when 1 was expected",
- serverInitializer.exceptionHandler.latch2.await(1, TimeUnit.SECONDS));
+ assertFalse(serverInitializer.exceptionHandler.latch2.await(1, TimeUnit.SECONDS),
+ "Encountered " + serverInitializer.exceptionHandler.count.get() +
+ " exceptions when 1 was expected");
} finally {
if (serverChannel != null) {
serverChannel.close().syncUninterruptibly();
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFileRegionTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFileRegionTest.java
index 5639e5cb0f..702d031ca2 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFileRegionTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFileRegionTest.java
@@ -29,7 +29,8 @@ import io.netty.channel.FileRegion;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.util.internal.PlatformDependent;
import org.hamcrest.CoreMatchers;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import java.io.File;
import java.io.FileOutputStream;
@@ -41,7 +42,8 @@ import java.util.concurrent.atomic.AtomicReference;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
public class SocketFileRegionTest extends AbstractSocketTest {
@@ -52,33 +54,63 @@ public class SocketFileRegionTest extends AbstractSocketTest {
}
@Test
- public void testFileRegion() throws Throwable {
- run();
+ public void testFileRegion(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testFileRegion(serverBootstrap, bootstrap);
+ }
+ });
}
@Test
- public void testCustomFileRegion() throws Throwable {
- run();
+ public void testCustomFileRegion(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testCustomFileRegion(serverBootstrap, bootstrap);
+ }
+ });
}
@Test
- public void testFileRegionNotAutoRead() throws Throwable {
- run();
+ public void testFileRegionNotAutoRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testFileRegionNotAutoRead(serverBootstrap, bootstrap);
+ }
+ });
}
@Test
- public void testFileRegionVoidPromise() throws Throwable {
- run();
+ public void testFileRegionVoidPromise(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testFileRegionVoidPromise(serverBootstrap, bootstrap);
+ }
+ });
}
@Test
- public void testFileRegionVoidPromiseNotAutoRead() throws Throwable {
- run();
+ public void testFileRegionVoidPromiseNotAutoRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testFileRegionVoidPromiseNotAutoRead(serverBootstrap, bootstrap);
+ }
+ });
}
@Test
- public void testFileRegionCountLargerThenFile() throws Throwable {
- run();
+ public void testFileRegionCountLargerThenFile(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testFileRegionCountLargerThenFile(serverBootstrap, bootstrap);
+ }
+ });
}
public void testFileRegion(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFixedLengthEchoTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFixedLengthEchoTest.java
index 5241b539e4..17262db065 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFixedLengthEchoTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFixedLengthEchoTest.java
@@ -25,13 +25,14 @@ import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.FixedLengthFrameDecoder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import java.io.IOException;
import java.util.Random;
import java.util.concurrent.atomic.AtomicReference;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class SocketFixedLengthEchoTest extends AbstractSocketTest {
@@ -43,13 +44,23 @@ public class SocketFixedLengthEchoTest extends AbstractSocketTest {
}
@Test
- public void testFixedLengthEcho() throws Throwable {
- run();
+ public void testFixedLengthEcho(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testFixedLengthEcho(serverBootstrap, bootstrap);
+ }
+ });
}
@Test
- public void testFixedLengthEchoNotAutoRead() throws Throwable {
- run();
+ public void testFixedLengthEchoNotAutoRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testFixedLengthEchoNotAutoRead(serverBootstrap, bootstrap);
+ }
+ });
}
public void testFixedLengthEcho(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketGatheringWriteTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketGatheringWriteTest.java
index d9f477173c..dc74cd14b7 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketGatheringWriteTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketGatheringWriteTest.java
@@ -29,25 +29,24 @@ import io.netty.testsuite.util.TestUtils;
import io.netty.util.concurrent.ImmediateEventExecutor;
import io.netty.util.concurrent.Promise;
import io.netty.util.internal.StringUtil;
-import org.junit.AfterClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.Timeout;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.io.IOException;
import java.util.Random;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import static io.netty.buffer.Unpooled.compositeBuffer;
import static io.netty.buffer.Unpooled.wrappedBuffer;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SocketGatheringWriteTest extends AbstractSocketTest {
-
- @Rule
- public final Timeout globalTimeout = new Timeout(120000);
+ private static final long TIMEOUT = 120000;
private static final Random random = new Random();
static final byte[] data = new byte[1048576];
@@ -56,14 +55,20 @@ public class SocketGatheringWriteTest extends AbstractSocketTest {
random.nextBytes(data);
}
- @AfterClass
+ @AfterAll
public static void compressHeapDumps() throws Exception {
TestUtils.compressHeapDumps();
}
@Test
- public void testGatheringWrite() throws Throwable {
- run();
+ @Timeout(value = TIMEOUT, unit = TimeUnit.MILLISECONDS)
+ public void testGatheringWrite(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testGatheringWrite(serverBootstrap, bootstrap);
+ }
+ });
}
public void testGatheringWrite(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -71,8 +76,14 @@ public class SocketGatheringWriteTest extends AbstractSocketTest {
}
@Test
- public void testGatheringWriteNotAutoRead() throws Throwable {
- run();
+ @Timeout(value = TIMEOUT, unit = TimeUnit.MILLISECONDS)
+ public void testGatheringWriteNotAutoRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testGatheringWriteNotAutoRead(serverBootstrap, bootstrap);
+ }
+ });
}
public void testGatheringWriteNotAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -80,27 +91,45 @@ public class SocketGatheringWriteTest extends AbstractSocketTest {
}
@Test
- public void testGatheringWriteWithComposite() throws Throwable {
- run();
- }
-
- public void testGatheringWriteWithCompositeNotAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
- testGatheringWrite0(sb, cb, data, true, false);
- }
-
- @Test
- public void testGatheringWriteWithCompositeNotAutoRead() throws Throwable {
- run();
+ @Timeout(value = TIMEOUT, unit = TimeUnit.MILLISECONDS)
+ public void testGatheringWriteWithComposite(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testGatheringWriteWithComposite(serverBootstrap, bootstrap);
+ }
+ });
}
public void testGatheringWriteWithComposite(ServerBootstrap sb, Bootstrap cb) throws Throwable {
testGatheringWrite0(sb, cb, data, true, true);
}
+ @Test
+ @Timeout(value = TIMEOUT, unit = TimeUnit.MILLISECONDS)
+ public void testGatheringWriteWithCompositeNotAutoRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testGatheringWriteWithCompositeNotAutoRead(serverBootstrap, bootstrap);
+ }
+ });
+ }
+
+ public void testGatheringWriteWithCompositeNotAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
+ testGatheringWrite0(sb, cb, data, true, false);
+ }
+
// Test for https://github.com/netty/netty/issues/2647
@Test
- public void testGatheringWriteBig() throws Throwable {
- run();
+ @Timeout(value = TIMEOUT, unit = TimeUnit.MILLISECONDS)
+ public void testGatheringWriteBig(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testGatheringWriteBig(serverBootstrap, bootstrap);
+ }
+ });
}
public void testGatheringWriteBig(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketHalfClosedTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketHalfClosedTest.java
index 1812e097a8..f2d6466dc6 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketHalfClosedTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketHalfClosedTest.java
@@ -35,8 +35,9 @@ import io.netty.channel.socket.ChannelOutputShutdownEvent;
import io.netty.channel.socket.DuplexChannel;
import io.netty.util.UncheckedBooleanSupplier;
import io.netty.util.internal.PlatformDependent;
-import org.junit.Assume;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -44,14 +45,21 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
public class SocketHalfClosedTest extends AbstractSocketTest {
- @Test(timeout = 10000)
- public void testHalfClosureOnlyOneEventWhenAutoRead() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 10000, unit = MILLISECONDS)
+ public void testHalfClosureOnlyOneEventWhenAutoRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testHalfClosureOnlyOneEventWhenAutoRead(serverBootstrap, bootstrap);
+ }
+ });
}
public void testHalfClosureOnlyOneEventWhenAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -120,8 +128,13 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
}
@Test
- public void testAllDataReadAfterHalfClosure() throws Throwable {
- run();
+ public void testAllDataReadAfterHalfClosure(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testAllDataReadAfterHalfClosure(serverBootstrap, bootstrap);
+ }
+ });
}
public void testAllDataReadAfterHalfClosure(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -217,8 +230,8 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
serverInitializedLatch.await();
clientReadAllDataLatch.await();
clientHalfClosedLatch.await();
- assertTrue("too many read complete events: " + clientReadCompletes.get(),
- totalServerBytesWritten / numReadsPerReadLoop + 10 > clientReadCompletes.get());
+ assertTrue(totalServerBytesWritten / numReadsPerReadLoop + 10 > clientReadCompletes.get(),
+ "too many read complete events: " + clientReadCompletes.get());
} finally {
if (clientChannel != null) {
clientChannel.close().sync();
@@ -230,10 +243,15 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
}
@Test
- public void testAutoCloseFalseDoesShutdownOutput() throws Throwable {
+ public void testAutoCloseFalseDoesShutdownOutput(TestInfo testInfo) throws Throwable {
// This test only works on Linux / BSD / MacOS as we assume some semantics that are not true for Windows.
- Assume.assumeFalse(PlatformDependent.isWindows());
- run();
+ assumeFalse(PlatformDependent.isWindows());
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testAutoCloseFalseDoesShutdownOutput(serverBootstrap, bootstrap);
+ }
+ });
}
public void testAutoCloseFalseDoesShutdownOutput(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -436,8 +454,13 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
}
@Test
- public void testAllDataReadClosure() throws Throwable {
- run();
+ public void testAllDataReadClosure(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testAllDataReadClosure(serverBootstrap, bootstrap);
+ }
+ });
}
public void testAllDataReadClosure(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -537,8 +560,8 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
serverInitializedLatch.await();
clientReadAllDataLatch.await();
clientHalfClosedLatch.await();
- assertTrue("too many read complete events: " + clientReadCompletes.get(),
- totalServerBytesWritten / numReadsPerReadLoop + 10 > clientReadCompletes.get());
+ assertTrue(totalServerBytesWritten / numReadsPerReadLoop + 10 > clientReadCompletes.get(),
+ "too many read complete events: " + clientReadCompletes.get());
} finally {
if (clientChannel != null) {
clientChannel.close().sync();
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketMultipleConnectTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketMultipleConnectTest.java
index b8b3976ae3..3019e6bca1 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketMultipleConnectTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketMultipleConnectTest.java
@@ -23,19 +23,28 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.testsuite.transport.TestsuitePermutation;
import io.netty.util.NetUtil;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.nio.channels.AlreadyConnectedException;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.TimeUnit;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SocketMultipleConnectTest extends AbstractSocketTest {
- @Test(timeout = 30000)
- public void testMultipleConnect() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testMultipleConnect(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testMultipleConnect(serverBootstrap, bootstrap);
+ }
+ });
}
public void testMultipleConnect(ServerBootstrap sb, Bootstrap cb) throws Exception {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketObjectEchoTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketObjectEchoTest.java
index 4c1b6833a2..ded7475e72 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketObjectEchoTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketObjectEchoTest.java
@@ -25,13 +25,14 @@ import io.netty.channel.ChannelOption;
import io.netty.handler.codec.serialization.ClassResolvers;
import io.netty.handler.codec.serialization.ObjectDecoder;
import io.netty.handler.codec.serialization.ObjectEncoder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import java.io.IOException;
import java.util.Random;
import java.util.concurrent.atomic.AtomicReference;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class SocketObjectEchoTest extends AbstractSocketTest {
@@ -51,8 +52,13 @@ public class SocketObjectEchoTest extends AbstractSocketTest {
}
@Test
- public void testObjectEcho() throws Throwable {
- run();
+ public void testObjectEcho(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testObjectEcho(serverBootstrap, bootstrap);
+ }
+ });
}
public void testObjectEcho(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -60,8 +66,13 @@ public class SocketObjectEchoTest extends AbstractSocketTest {
}
@Test
- public void testObjectEchoNotAutoRead() throws Throwable {
- run();
+ public void testObjectEchoNotAutoRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testObjectEchoNotAutoRead(serverBootstrap, bootstrap);
+ }
+ });
}
public void testObjectEchoNotAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketReadPendingTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketReadPendingTest.java
index ed3e3fa17c..ac97872c50 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketReadPendingTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketReadPendingTest.java
@@ -29,20 +29,28 @@ import io.netty.channel.ChannelOption;
import io.netty.channel.RecvByteBufAllocator;
import io.netty.util.ReferenceCountUtil;
import io.netty.util.UncheckedBooleanSupplier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SocketReadPendingTest extends AbstractSocketTest {
- @Test(timeout = 60000)
- public void testReadPendingIsResetAfterEachRead() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS)
+ public void testReadPendingIsResetAfterEachRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testReadPendingIsResetAfterEachRead(serverBootstrap, bootstrap);
+ }
+ });
}
public void testReadPendingIsResetAfterEachRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketRstTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketRstTest.java
index 6690a50d17..ab668806b1 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketRstTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketRstTest.java
@@ -22,27 +22,36 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.io.IOException;
import java.util.Locale;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class SocketRstTest extends AbstractSocketTest {
protected void assertRstOnCloseException(IOException cause, Channel clientChannel) {
if (Locale.getDefault() == Locale.US || Locale.getDefault() == Locale.UK) {
- assertTrue("actual message: " + cause.getMessage(),
- cause.getMessage().contains("reset") || cause.getMessage().contains("closed"));
+ assertTrue(cause.getMessage().contains("reset") || cause.getMessage().contains("closed"),
+ "actual message: " + cause.getMessage());
}
}
- @Test(timeout = 3000)
- public void testSoLingerZeroCausesOnlyRstOnClose() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
+ public void testSoLingerZeroCausesOnlyRstOnClose(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testSoLingerZeroCausesOnlyRstOnClose(serverBootstrap, bootstrap);
+ }
+ });
}
public void testSoLingerZeroCausesOnlyRstOnClose(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -89,15 +98,21 @@ public class SocketRstTest extends AbstractSocketTest {
// Verify the client received a RST.
Throwable cause = throwableRef.get();
- assertTrue("actual [type, message]: [" + cause.getClass() + ", " + cause.getMessage() + "]",
- cause instanceof IOException);
+ assertTrue(cause instanceof IOException,
+ "actual [type, message]: [" + cause.getClass() + ", " + cause.getMessage() + "]");
assertRstOnCloseException((IOException) cause, cc);
}
- @Test(timeout = 3000)
- public void testNoRstIfSoLingerOnClose() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
+ public void testNoRstIfSoLingerOnClose(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testNoRstIfSoLingerOnClose(serverBootstrap, bootstrap);
+ }
+ });
}
public void testNoRstIfSoLingerOnClose(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketShutdownOutputBySelfTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketShutdownOutputBySelfTest.java
index 22a9fb98d8..ab8a5dfc03 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketShutdownOutputBySelfTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketShutdownOutputBySelfTest.java
@@ -26,8 +26,10 @@ import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.WriteBufferWaterMark;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.oio.OioSocketChannel;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.net.ServerSocket;
import java.net.Socket;
@@ -39,18 +41,24 @@ import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
public class SocketShutdownOutputBySelfTest extends AbstractClientSocketTest {
- @Test(timeout = 30000)
- public void testShutdownOutput() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testShutdownOutput(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap) throws Throwable {
+ testShutdownOutput(bootstrap);
+ }
+ });
}
public void testShutdownOutput(Bootstrap cb) throws Throwable {
@@ -96,9 +104,15 @@ public class SocketShutdownOutputBySelfTest extends AbstractClientSocketTest {
}
}
- @Test(timeout = 30000)
- public void testShutdownOutputAfterClosed() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testShutdownOutputAfterClosed(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap) throws Throwable {
+ testShutdownOutputAfterClosed(bootstrap);
+ }
+ });
}
public void testShutdownOutputAfterClosed(Bootstrap cb) throws Throwable {
@@ -132,10 +146,16 @@ public class SocketShutdownOutputBySelfTest extends AbstractClientSocketTest {
}
}
- @Ignore
- @Test(timeout = 30000)
- public void testWriteAfterShutdownOutputNoWritabilityChange() throws Throwable {
- run();
+ @Disabled
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testWriteAfterShutdownOutputNoWritabilityChange(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap) throws Throwable {
+ testWriteAfterShutdownOutputNoWritabilityChange(bootstrap);
+ }
+ });
}
public void testWriteAfterShutdownOutputNoWritabilityChange(Bootstrap cb) throws Throwable {
@@ -196,18 +216,30 @@ public class SocketShutdownOutputBySelfTest extends AbstractClientSocketTest {
}
}
- @Test(timeout = 30000)
- public void testShutdownOutputSoLingerNoAssertError() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testShutdownOutputSoLingerNoAssertError(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap) throws Throwable {
+ testShutdownOutputSoLingerNoAssertError(bootstrap);
+ }
+ });
}
public void testShutdownOutputSoLingerNoAssertError(Bootstrap cb) throws Throwable {
testShutdownSoLingerNoAssertError0(cb, true);
}
- @Test(timeout = 30000)
- public void testShutdownSoLingerNoAssertError() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
+ public void testShutdownSoLingerNoAssertError(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(Bootstrap bootstrap) throws Throwable {
+ testShutdownSoLingerNoAssertError(bootstrap);
+ }
+ });
}
public void testShutdownSoLingerNoAssertError(Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSpdyEchoTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSpdyEchoTest.java
index 7ab246f367..938e0c983e 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSpdyEchoTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSpdyEchoTest.java
@@ -28,10 +28,13 @@ import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.spdy.SpdyFrameCodec;
import io.netty.handler.codec.spdy.SpdyVersion;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
import java.io.IOException;
import java.util.Random;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import static org.junit.Assert.*;
@@ -143,9 +146,15 @@ public class SocketSpdyEchoTest extends AbstractSocketTest {
return frames;
}
- @Test(timeout = 15000)
- public void testSpdyEcho() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 15000, unit = TimeUnit.MILLISECONDS)
+ public void testSpdyEcho(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testSpdyEcho(serverBootstrap, bootstrap);
+ }
+ });
}
public void testSpdyEcho(ServerBootstrap sb, Bootstrap cb) throws Throwable {
@@ -153,9 +162,15 @@ public class SocketSpdyEchoTest extends AbstractSocketTest {
testSpdyEcho(sb, cb, SpdyVersion.SPDY_3_1, true);
}
- @Test(timeout = 15000)
- public void testSpdyEchoNotAutoRead() throws Throwable {
- run();
+ @Test
+ @Timeout(value = 15000, unit = TimeUnit.MILLISECONDS)
+ public void testSpdyEchoNotAutoRead(TestInfo testInfo) throws Throwable {
+ run(testInfo, new Runner() {
+ @Override
+ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
+ testSpdyEchoNotAutoRead(serverBootstrap, bootstrap);
+ }
+ });
}
public void testSpdyEchoNotAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
diff --git a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslClientRenegotiateTest.java b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslClientRenegotiateTest.java
index f6eb0bf5ee..ed91927ad9 100644
--- a/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslClientRenegotiateTest.java
+++ b/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslClientRenegotiateTest.java
@@ -35,11 +35,11 @@ import io.netty.handler.ssl.util.SelfSignedCertificate;
import io.netty.util.concurrent.Future;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
-import org.junit.Assume;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.condition.DisabledIf;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
import java.io.File;
import java.nio.channels.ClosedChannelException;
@@ -50,17 +50,18 @@ import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import javax.net.ssl.SSLHandshakeException;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
-@RunWith(Parameterized.class)
public class SocketSslClientRenegotiateTest extends AbstractSocketTest {
-
private static final InternalLogger logger = InternalLoggerFactory.getInstance(
SocketSslClientRenegotiateTest.class);
private static final File CERT_FILE;
@@ -77,7 +78,10 @@ public class SocketSslClientRenegotiateTest extends AbstractSocketTest {
KEY_FILE = ssc.privateKey();
}
- @Parameters(name = "{index}: serverEngine = {0}, clientEngine = {1}, delegate = {2}")
+ private static boolean openSslNotAvailable() {
+ return !OpenSsl.isAvailable();
+ }
+
public static Collection