@Test public void testShouldReturnIpAddressFromHostName() { InetSocketAddress inetSocketAddress = InetSocketAddress.createUnresolved("localhost", 8001); SocketAddress socketAddress = DnsUntil.checkInetSocketAddress(inetSocketAddress); InetSocketAddress unresolved = InetSocketAddress.createUnresolved("127.0.0.1", 8001); Assert.assertTrue(socketAddress.equals(unresolved)); }
public static SocketAddress checkInetSocketAddress(SocketAddress address) { InetSocketAddress inetSocketAddress = (InetSocketAddress) address; String hostName = inetSocketAddress.getHostName(); if (hasLetters(hostName)) { return toIpAddress(hostName, inetSocketAddress.getPort()); } else { return inetSocketAddress; } }
DnsUntil { public static SocketAddress checkInetSocketAddress(SocketAddress address) { InetSocketAddress inetSocketAddress = (InetSocketAddress) address; String hostName = inetSocketAddress.getHostName(); if (hasLetters(hostName)) { return toIpAddress(hostName, inetSocketAddress.getPort()); } else { return inetSocketAddress; } } }
DnsUntil { public static SocketAddress checkInetSocketAddress(SocketAddress address) { InetSocketAddress inetSocketAddress = (InetSocketAddress) address; String hostName = inetSocketAddress.getHostName(); if (hasLetters(hostName)) { return toIpAddress(hostName, inetSocketAddress.getPort()); } else { return inetSocketAddress; } } private  DnsUntil(); }
DnsUntil { public static SocketAddress checkInetSocketAddress(SocketAddress address) { InetSocketAddress inetSocketAddress = (InetSocketAddress) address; String hostName = inetSocketAddress.getHostName(); if (hasLetters(hostName)) { return toIpAddress(hostName, inetSocketAddress.getPort()); } else { return inetSocketAddress; } } private  DnsUntil(); static SocketAddress checkInetSocketAddress(SocketAddress address); static InetSocketAddress toIpAddress(String hostName, int port); }
DnsUntil { public static SocketAddress checkInetSocketAddress(SocketAddress address) { InetSocketAddress inetSocketAddress = (InetSocketAddress) address; String hostName = inetSocketAddress.getHostName(); if (hasLetters(hostName)) { return toIpAddress(hostName, inetSocketAddress.getPort()); } else { return inetSocketAddress; } } private  DnsUntil(); static SocketAddress checkInetSocketAddress(SocketAddress address); static InetSocketAddress toIpAddress(String hostName, int port);  }