test/jdk/net/Sockets/Test.java

Print this page

        

@@ -30,10 +30,11 @@
  */
 
 import java.net.*;
 import java.nio.channels.*;
 import java.util.concurrent.*;
+import java.util.Set;
 import jdk.net.*;
 
 public class Test {
 
     static boolean security;

@@ -73,10 +74,17 @@
         final InetSocketAddress loopad = new InetSocketAddress(loop, tcp_port);
 
         DatagramSocket dg = new DatagramSocket(0);
         final int udp_port = dg.getLocalPort();
 
+        // If option not available, end test
+        Set<SocketOption<?>> options = dg.supportedOptions();
+        if (!options.contains(ExtendedSocketOptions.SO_FLOW_SLA)) {
+            System.out.println("SO_FLOW_SLA not supported");
+            return;
+        }
+
         final Socket s = new Socket("127.0.0.1", tcp_port);
         final SocketChannel sc = SocketChannel.open();
         sc.connect (new InetSocketAddress("127.0.0.1", tcp_port));
 
         doTest(()->{