public boolean isKdcReachable(String server, int port) {
    boolean success = isKdcReachable(server, port, ConnectionProtocol.TCP) || isKdcReachable(server, port, ConnectionProtocol.UDP);

    if (!success) {
      LOG.error("Failed to connect to the KDC at {}:{} using either TCP or UDP", server, port);
    }

    return success;
  }
Given a host and port, checks if server is reachable meaning that we
can communicate with it.  First we attempt to connect via TCP and if
that is unsuccessful, attempt via UDP. It is important to understand that
we are not validating credentials, only attempting to communicate with server
process for the give host and port.

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