RFR [9] 8158270: MulticastSendReceiveTests.java failed with "Expected message not received"

Chris Hegarty chris.hegarty at oracle.com
Thu Apr 20 14:05:27 UTC 2017


Following on from the work done in 8177536 [1] to avoid the Apple
Peer-to-Peer interface during multicast testing, the NIO test helper
class should be updated to do the same.

Note: the recently added test/lib/testlibrary/jdk/testlibrary/NetworkConfiguration.java
has such functionality, and the NIO tests could be updated to use
it a some future point, but for now I just want to do a minimal 
change in 9 to get the test reliably passing again.

diff --git a/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java b/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java
--- a/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java
+++ b/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java
@@ -57,6 +57,9 @@
         return ip6Interfaces.get(nif);
     }
 
+    private static final boolean isMacOS =
+            System.getProperty("os.name").contains("OS X");
+
     static NetworkConfiguration probe() throws IOException {
         Map<NetworkInterface,List<InetAddress>> ip4Interfaces =
             new HashMap<NetworkInterface,List<InetAddress>>();
@@ -67,8 +70,9 @@
         List<NetworkInterface> nifs = Collections
             .list(NetworkInterface.getNetworkInterfaces());
         for (NetworkInterface nif: nifs) {
-            // ignore intertaces that are down or don't support multicast
-            if (!nif.isUp() || !nif.supportsMulticast() || nif.isLoopback())
+            // ignore interfaces that are down or don't support multicast
+            if (!nif.isUp() || !nif.supportsMulticast() || nif.isLoopback()
+                || (isMacOS && nif.getName().contains("awdl")))
                 continue;
 
             List<InetAddress> addrs = Collections.list(nif.getInetAddresses());

-Chris.

[1] https://bugs.openjdk.java.net/browse/JDK-8177536


More information about the nio-dev mailing list