< prev index next >
jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java
Print this page
rev 17203 : 8180644: move jdk.testlibrary.NetworkConfiguration to the top level test library
Reviewed-by: duke
@@ -22,11 +22,12 @@
*/
/* @test
* @bug 4527345 7026376 6633549
* @summary Unit test for DatagramChannel's multicast support
- * @build MulticastSendReceiveTests NetworkConfiguration
+ * @library /test/lib
+ * @build MulticastSendReceiveTests
* @run main MulticastSendReceiveTests
* @run main/othervm -Djava.net.preferIPv4Stack=true MulticastSendReceiveTests
* @key randomness
*/
@@ -34,10 +35,13 @@
import java.nio.channels.*;
import java.net.*;
import static java.net.StandardProtocolFamily.*;
import java.util.*;
import java.io.IOException;
+import java.util.stream.Collectors;
+
+import jdk.test.lib.NetworkConfiguration;
public class MulticastSendReceiveTests {
static final Random rand = new Random();
@@ -236,18 +240,19 @@
NetworkConfiguration config = NetworkConfiguration.probe();
// multicast groups used for the test
InetAddress ip4Group = InetAddress.getByName("225.4.5.6");
InetAddress ip6Group = InetAddress.getByName("ff02::a");
-
- for (NetworkInterface nif: config.ip4Interfaces()) {
+ for (NetworkInterface nif: config.ip4MulticastInterfaces()
+ .collect(Collectors.toList())) {
InetAddress source = config.ip4Addresses(nif).iterator().next();
test(INET, nif, ip4Group, source);
test(UNSPEC, nif, ip4Group, source);
}
- for (NetworkInterface nif: config.ip6Interfaces()) {
+ for (NetworkInterface nif: config.ip6MulticastInterfaces()
+ .collect(Collectors.toList())) {
InetAddress source = config.ip6Addresses(nif).iterator().next();
test(INET6, nif, ip6Group, source);
test(UNSPEC, nif, ip6Group, source);
}
}
< prev index next >