@Override
    public SaslServer createSaslServer(String mechanism, String protocol, String serverName,
      Map<String, ?> props, CallbackHandler cbh) {
      if (PLAIN_METHOD.equals(mechanism)) {
        try {
          return new PlainSaslServer(cbh, protocol);
        } catch (SaslException e) {
          /* This is to fulfill the contract of the interface which states that an exception shall
             be thrown when a SaslServer cannot be created due to an error but null should be
             returned when a Server can't be created due to the parameters supplied. And the only
             thing PlainSaslServer can fail on is a non-supported authentication mechanism.
             That's why we return null instead of throwing the Exception */
          return null;
        }
      }
      return null;
    }
Sun JDK only provides a PLAIN client and no server. This class implements the Plain SASL server
conforming to RFC #4616 (http://www.ietf.org/rfc/rfc4616.txt).
service/src/java/org/apache/hive/service/auth/PlainSaslServer.java