@Test public void testLinkLocalOnly() { final Enumeration<NetworkInterface> nis = enumeration(singletonList(createInterface("169.254.172.42"))); assertNull(NetworkUtils.getIpAddress(nis)); }
public static String getIpAddress(final Enumeration<NetworkInterface> nis) { while (nis.hasMoreElements()) { final NetworkInterface ni = nis.nextElement(); final String address = getIpAddress(ni); if (address != null && !address.startsWith("127.") && !address.startsWith("169.")) { return address; } } return null; }
NetworkUtils { public static String getIpAddress(final Enumeration<NetworkInterface> nis) { while (nis.hasMoreElements()) { final NetworkInterface ni = nis.nextElement(); final String address = getIpAddress(ni); if (address != null && !address.startsWith("127.") && !address.startsWith("169.")) { return address; } } return null; } }
NetworkUtils { public static String getIpAddress(final Enumeration<NetworkInterface> nis) { while (nis.hasMoreElements()) { final NetworkInterface ni = nis.nextElement(); final String address = getIpAddress(ni); if (address != null && !address.startsWith("127.") && !address.startsWith("169.")) { return address; } } return null; } NetworkUtils(); }
NetworkUtils { public static String getIpAddress(final Enumeration<NetworkInterface> nis) { while (nis.hasMoreElements()) { final NetworkInterface ni = nis.nextElement(); final String address = getIpAddress(ni); if (address != null && !address.startsWith("127.") && !address.startsWith("169.")) { return address; } } return null; } NetworkUtils(); static String getIpAddress(final Enumeration<NetworkInterface> nis); }
NetworkUtils { public static String getIpAddress(final Enumeration<NetworkInterface> nis) { while (nis.hasMoreElements()) { final NetworkInterface ni = nis.nextElement(); final String address = getIpAddress(ni); if (address != null && !address.startsWith("127.") && !address.startsWith("169.")) { return address; } } return null; } NetworkUtils(); static String getIpAddress(final Enumeration<NetworkInterface> nis);  }