jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java
changeset 45186 387a39577f09
parent 30435 f9d75cf4dab8
child 45467 99c87a16a8e4
--- a/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java	Fri May 19 16:34:37 2017 +0000
+++ b/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java	Fri May 19 13:33:47 2017 -0700
@@ -25,7 +25,8 @@
  * @bug 8014377
  * @summary Test for interference when two sockets are bound to the same
  *   port but joined to different multicast groups
- * @build Promiscuous  NetworkConfiguration
+ * @library /test/lib
+ * @build Promiscuous
  * @run main Promiscuous
  * @run main/othervm -Djava.net.preferIPv4Stack=true Promiscuous
  * @key randomness
@@ -37,6 +38,9 @@
 import static java.net.StandardProtocolFamily.*;
 import java.util.*;
 import java.io.IOException;
+import java.util.stream.Collectors;
+
+import jdk.test.lib.NetworkConfiguration;
 
 public class Promiscuous {
 
@@ -208,7 +212,8 @@
         InetAddress ip4Group1 = InetAddress.getByName("225.4.5.6");
         InetAddress ip4Group2 = InetAddress.getByName("225.4.6.6");
 
-        for (NetworkInterface nif: config.ip4Interfaces()) {
+        for (NetworkInterface nif: config.ip4MulticastInterfaces()
+                                         .collect(Collectors.toList())) {
             InetAddress source = config.ip4Addresses(nif).iterator().next();
             test(INET, nif, ip4Group1, ip4Group2);