The java/net/SocketOption/OptionTest test chooses the first network interface returned by NetworkInterface.getNetworkInterfaces() for doing some tests on multicast sockets.
But it may be that the chosen interface does not even support multicasting. So better iterate over all interfaces and only choose one if NetworkInterface.supportsMulticast() returns true.
But it may be that the chosen interface does not even support multicasting. So better iterate over all interfaces and only choose one if NetworkInterface.supportsMulticast() returns true.