public boolean isKdcReachable(String kdcHost) {
    try {
      if (kdcHost == null || kdcHost.isEmpty()) {
        throw new IllegalArgumentException("Invalid hostname for KDC server");
      }
      String[] kdcDetails = kdcHost.split(":");
      if (kdcDetails.length == 1) {
        return isKdcReachable(kdcDetails[0], parsePort(config.getDefaultKdcPort()));
      } else {
        return isKdcReachable(kdcDetails[0], parsePort(kdcDetails[1]));
      }
    } catch (Exception e) {
      LOG.error("Exception while checking KDC reachability: " + e);
      return false;
    }
  }
Given server IP or hostname, checks if server is reachable i.e.
we can make a socket connection to it. Hostname may contain port
number separated by a colon.

@param kdcHost KDC server IP or hostname (with optional port number)
@return true, if server is accepting connection given port; false otherwise.
ambari-server/src/main/java/org/apache/ambari/server/KdcServerConnectionVerification.java