How to fix "java.net.SocketException: Can't assign requested address" on macOS

If you get the above exception on macOS and you can trace the exception to "MulticastSocket.joinGroup", then you can fix this issue by setting a particular Java VM property. This issue allegedly occurs on newer versions of macOS when using WiFi; the underlying Java implementation needs to set a network interface to perform multicast on and the operating system will hand off an IPv6 compliant interface by default when the multicast implementation needs an IPv4 interface.

Set the following VM argument in your run configuration to fix the problem: "-Djava.net.preferIPv4Stack=true"