More test cleanup niosocketimpl-branch
authoralanb
Tue, 30 Apr 2019 11:23:02 +0100
branchniosocketimpl-branch
changeset 57342 5b512573ccb8
parent 57341 733e9746d615
child 57344 8b621b0d921c
More test cleanup
src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java
test/jdk/java/net/SocketOption/OptionsTest.java
test/jdk/java/net/ipv6tests/TcpTest.java
--- a/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java	Mon Apr 29 09:03:06 2019 +0100
+++ b/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java	Tue Apr 30 11:23:02 2019 +0100
@@ -911,7 +911,7 @@
             this.state = ST_CLOSING;
             assert fd != null && closer != null;
 
-            // shutdown output when linger interval not set
+            // shutdown output when linger interval not set to 0
             try {
                 var SO_LINGER = StandardSocketOptions.SO_LINGER;
                 if ((int) Net.getSocketOption(fd, SO_LINGER) != 0) {
--- a/test/jdk/java/net/SocketOption/OptionsTest.java	Mon Apr 29 09:03:06 2019 +0100
+++ b/test/jdk/java/net/SocketOption/OptionsTest.java	Tue Apr 30 11:23:02 2019 +0100
@@ -153,7 +153,9 @@
         }
 
         // connected socket
-        try (ServerSocket ss = new ServerSocket(0)) {
+        try (ServerSocket ss = new ServerSocket()) {
+            var loopback = InetAddress.getLoopbackAddress();
+            ss.bind(new InetSocketAddress(loopback, 0));
             try (Socket s1 = new Socket()) {
                 s1.connect(ss.getLocalSocketAddress());
                 try (Socket s2 = ss.accept()) {
--- a/test/jdk/java/net/ipv6tests/TcpTest.java	Mon Apr 29 09:03:06 2019 +0100
+++ b/test/jdk/java/net/ipv6tests/TcpTest.java	Tue Apr 30 11:23:02 2019 +0100
@@ -29,8 +29,8 @@
  * @library /test/lib
  * @build jdk.test.lib.NetworkConfiguration
  *        jdk.test.lib.Platform
- * @run main TcpTest
- * @run main/othervm -Djdk.net.usePlainSocketImpl TcpTest
+ * @run main TcpTest -d
+ * @run main/othervm -Djdk.net.usePlainSocketImpl TcpTest -d
  */
 
 import java.net.*;