@Test
public void findLocalAddress() throws SocketException {

    Enumeration<NetworkInterface> ifs = NetworkInterface.getNetworkInterfaces();
    System.out.println("IFs");
    boolean found = false;
    while (ifs.hasMoreElements()) {
        NetworkInterface intf = ifs.nextElement();
        System.out.println(intf + " is loopback: " + intf.isLoopback());
        found = found || (!intf.isLoopback() && intf.supportsMulticast() && intf.isUp());
    }
    InetAddress addr = NetworkUtil.findLocalAddressViaNetworkInterface();
    System.out.println("Address found via NIF: " + addr);
    assertTrue(found ? addr != null : addr == null);
    if (addr != null) {
        assertTrue(addr instanceof Inet4Address);
    }
}