public static boolean isLocationReachable(InetSocketAddress endpoint,int timeoutMs,int retryCount,int retryIntervalMs){
  int retryLeft=retryCount;
  while (retryLeft > 0) {
    try (Socket s=new Socket()){
      s.connect(endpoint,timeoutMs);
      return true;
    }
 catch (    IOException e) {
    }
 finally {
      SysUtils.sleep(retryIntervalMs);
      retryLeft--;
    }
  }
  LOG.log(Level.FINE,"Failed to connect to: {0}",endpoint.toString());
  return false;
}

public static boolean isLocationReachable ( InetSocketAddress endpoint , int timeoutMs , int retryCount , int retryIntervalMs ) { int retryLeft = retryCount ; while ( retryLeft > 0 ) { try ( Socket s = new Socket ( ) ) { s . connect ( endpoint , timeoutMs ) ; return true ; } catch ( IOException e ) { } finally { SysUtils . sleep ( retryIntervalMs ) ; retryLeft -- ; } } LOG . log ( Level . FINE , "Failed to connect to: {0}" , endpoint . toString ( ) ) ; return false ; }
tests if a network location is reachable . this is best effort and may give false not reachable .
