@Test public void testShouldReturnIpAddress() { InetSocketAddress inetSocketAddress = DnsUntil.toIpAddress("localhost", 8001); InetSocketAddress unresolved = InetSocketAddress.createUnresolved("127.0.0.1", 8001); Assert.assertTrue(unresolved.equals(inetSocketAddress)); }
public static InetSocketAddress toIpAddress(String hostName, int port) { InetSocketAddress socketAddress; try { InetAddress address = InetAddress.getByName(hostName); String ipAddress = address.getHostAddress(); socketAddress = InetSocketAddress.createUnresolved(ipAddress, port); } catch (UnknownHostException e) { throw new RuntimeException(e); } return socketAddress; }
DnsUntil { public static InetSocketAddress toIpAddress(String hostName, int port) { InetSocketAddress socketAddress; try { InetAddress address = InetAddress.getByName(hostName); String ipAddress = address.getHostAddress(); socketAddress = InetSocketAddress.createUnresolved(ipAddress, port); } catch (UnknownHostException e) { throw new RuntimeException(e); } return socketAddress; } }
DnsUntil { public static InetSocketAddress toIpAddress(String hostName, int port) { InetSocketAddress socketAddress; try { InetAddress address = InetAddress.getByName(hostName); String ipAddress = address.getHostAddress(); socketAddress = InetSocketAddress.createUnresolved(ipAddress, port); } catch (UnknownHostException e) { throw new RuntimeException(e); } return socketAddress; } private  DnsUntil(); }
DnsUntil { public static InetSocketAddress toIpAddress(String hostName, int port) { InetSocketAddress socketAddress; try { InetAddress address = InetAddress.getByName(hostName); String ipAddress = address.getHostAddress(); socketAddress = InetSocketAddress.createUnresolved(ipAddress, port); } catch (UnknownHostException e) { throw new RuntimeException(e); } return socketAddress; } private  DnsUntil(); static SocketAddress checkInetSocketAddress(SocketAddress address); static InetSocketAddress toIpAddress(String hostName, int port); }
DnsUntil { public static InetSocketAddress toIpAddress(String hostName, int port) { InetSocketAddress socketAddress; try { InetAddress address = InetAddress.getByName(hostName); String ipAddress = address.getHostAddress(); socketAddress = InetSocketAddress.createUnresolved(ipAddress, port); } catch (UnknownHostException e) { throw new RuntimeException(e); } return socketAddress; } private  DnsUntil(); static SocketAddress checkInetSocketAddress(SocketAddress address); static InetSocketAddress toIpAddress(String hostName, int port);  }