IpUtils { public static String getIPFromURL(String url) { try { return Inet4Address.getByName(new URL(url).getHost()).getHostAddress(); } catch (Exception e) { _log.error(ExceptionUtils.errorInfo(e)); return null; } } private  IpUtils(); static boolean checkValid(final String ip); static boolean checkValid2(final String ip); static boolean checkValidV6(final String ip); static String removeTail32(String ip); static String extractDomain(String url); static String getTailFromURL(String url); static long ip2long(String ipAddress); static String long2ip(Long ipAddress); static Integer ip2int(String ipAddress); static Boolean checkIPRange(final String ipAddress, final String range); static String getIPFromURL(String url); static Boolean isReachable(final String ipAddress); static boolean ping(final String ipAddress); static List<String> getCurrentEnvironmentNetworkIps();  }
@Ignore @Test public void getIPFromURLTest() { assertNull(getIPFromURL("yuzhouwan.com")); assertNull(getIPFromURL("www.yuzhouwan.com")); System.out.println(getIPFromURL("http: System.out.println(getIPFromURL("https: System.out.println(getIPFromURL("http: System.out.println(getIPFromURL("ftp: System.out.println(getIPFromURL("http: }