test/jdk/java/net/Socket/LingerTest.java
changeset 54770 62b6e7587b1f
parent 54634 59c01214e478
child 54811 9db7c0f561a6
equal deleted inserted replaced
54769:925ee7a89325 54770:62b6e7587b1f
    22  */
    22  */
    23 
    23 
    24 /**
    24 /**
    25  * @test
    25  * @test
    26  * @bug 4796166
    26  * @bug 4796166
       
    27  * @library /test/lib
    27  * @summary Linger interval delays usage of released file descriptor
    28  * @summary Linger interval delays usage of released file descriptor
    28  * @run main LingerTest
    29  * @run main LingerTest
    29  * @run main/othervm -Djava.net.preferIPv4Stack=true LingerTest
    30  * @run main/othervm -Djava.net.preferIPv4Stack=true LingerTest
    30  */
    31  */
    31 
    32 
    32 import java.net.*;
    33 import java.net.*;
    33 import java.io.*;
    34 import java.io.*;
       
    35 import jdk.test.lib.net.IPSupport;
    34 
    36 
    35 public class LingerTest {
    37 public class LingerTest {
    36 
    38 
    37     static class Sender implements Runnable {
    39     static class Sender implements Runnable {
    38         Socket s;
    40         Socket s;
   103             return connected;
   105             return connected;
   104         }
   106         }
   105     }
   107     }
   106 
   108 
   107     public static void main(String args[]) throws Exception {
   109     public static void main(String args[]) throws Exception {
       
   110         IPSupport.skipIfCurrentConfigurationIsInvalid();
       
   111 
   108         InetAddress loopback = InetAddress.getLoopbackAddress();
   112         InetAddress loopback = InetAddress.getLoopbackAddress();
   109         ServerSocket ss = new ServerSocket(0, 50, loopback);
   113         ServerSocket ss = new ServerSocket(0, 50, loopback);
   110 
   114 
   111         Socket s1 = new Socket(loopback, ss.getLocalPort());
   115         Socket s1 = new Socket(loopback, ss.getLocalPort());
   112         Socket s2 = ss.accept();
   116         Socket s2 = ss.accept();