diff --git a/example/pom.xml b/example/pom.xml
index 6612dbca84..ec072fdb8d 100644
--- a/example/pom.xml
+++ b/example/pom.xml
@@ -139,6 +139,12 @@
org.bouncycastle
bcprov-jdk15on
+
+
+
+ com.sun.activation
+ javax.activation
+
diff --git a/pom.xml b/pom.xml
index 57299e9b9f..fcda89ca10 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,6 +68,23 @@
+
+
+ java11
+
+ 11
+
+
+
+
+ true
+
+ 3.0.0-M1
+
+ 2.0.5.Final
+
+
+
java10
@@ -268,6 +285,13 @@
${project.version}
+
+
+ com.sun.activation
+ javax.activation
+ 1.2.0
+
+
org.javassist
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 40b5e86ff7..cd03ac3c9b 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
@@ -37,6 +37,7 @@ import io.netty.util.UncheckedBooleanSupplier;
import org.junit.Test;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@@ -327,8 +328,18 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
public void operationComplete(ChannelFuture future) throws Exception {
future.channel().close().addListener(new ChannelFutureListener() {
@Override
- public void operationComplete(ChannelFuture future) throws Exception {
- followerCloseLatch.countDown();
+ public void operationComplete(final ChannelFuture future) throws Exception {
+ // This is a bit racy but there is no better way how to handle this in Java11.
+ // The problem is that on close() the underlying FD will not actually be closed directly
+ // but the close will be done after the Selector did process all events. Because of
+ // this we will need to give it a bit time to ensure the FD is actual closed before we
+ // count down the latch and try to write.
+ future.channel().eventLoop().schedule(new Runnable() {
+ @Override
+ public void run() {
+ followerCloseLatch.countDown();
+ }
+ }, 200, TimeUnit.MILLISECONDS);
}
});
}
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 4eb1b84653..88cef1236a 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,6 +22,8 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.util.internal.PlatformDependent;
import org.junit.Test;
import java.io.IOException;
@@ -89,8 +91,16 @@ public class SocketRstTest extends AbstractSocketTest {
// Verify the client received a RST.
Throwable cause = throwableRef.get();
+ if (PlatformDependent.javaVersion() >= 11 && sb.config().group() instanceof NioEventLoopGroup) {
+ // In Java11 calling SocketChannel.close() will also call shutdown(..,SHUT_WR) before actual closing the
+ // fd which means we may not see the ECONNRESET at all :(
+ if (cause == null) {
+ return;
+ }
+ }
assertTrue("actual [type, message]: [" + cause.getClass() + ", " + cause.getMessage() + "]",
- cause instanceof IOException);
+ cause instanceof IOException);
+
assertRstOnCloseException((IOException) cause, cc);
}