I have to distinguish "unknown host" and "host does not respond" cases in my code. I've used code:
URL url = new URL(providerURL);
try {
if (!InetAddress.getByName(url.getHost()).isReachable(60000)) {
System.out.println(url.getHost() + " is not reachable!");
}
} catch (UnknownHostException e) {
System.out.println(url.getHost() + " is unknown");
} catch (IOException e) {
System.out.println(url.getHost() + "throws IOException!");
}
It worked for usual sites like "http://www.cnn.com" or "https://www.discountbank.co.il/DB/private/out-of-account", but for my customer site I got "Host is not reachable!" despite of the fact that in each Browser it opens customer login dialog. What was wrong?