@Test public void testFargate() { final Enumeration<NetworkInterface> nis = enumeration(asList( createInterface("127.0.0.1"), createInterface("169.254.172.42"), createInterface("2001:0db8:85a3:0000:0000:8a2e:0370:7334", "10.0.0.1"))); assertEquals("10.0.0.1", 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);  }