code: public static boolean pingUrl(final String address) {
  
          try {
  
              final URL url = new URL("http://" + address);
  
              final HttpURLConnection urlConn = (HttpURLConnection) url
                      .openConnection();
  
              urlConn.setConnectTimeout(1000 * 10); // mTimeout is in seconds
  
              final long startTime = System.currentTimeMillis();
  
              urlConn.connect();
  
              final long endTime = System.currentTimeMillis();
  
              if (urlConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
                  LOGGER.info("Time (ms) : " + (endTime - startTime));
                  LOGGER.info("Ping to " + address + " was success");
                  return true;
              }
  
          } catch (final MalformedURLException e1) {
              e1.printStackTrace();
          } catch (final IOException e) {
              e.printStackTrace();
          }
          return false;
      }
docs: PING指定URL是否可用
  
  @param address
  @return