public static final ServerMechanism getInstance(String mechanism) {
      if (mechanism == null) {
         return null;
      }
      mechanism = mechanism.trim().toUpperCase();
      if (mechanism.equals(Registry.SASL_SRP_MECHANISM)) {
         return new SRPServer();
      }
      if (mechanism.equals(Registry.SASL_CRAM_MD5_MECHANISM)) {
         return new CramMD5Server();
      }
      if (mechanism.equals(Registry.SASL_PLAIN_MECHANISM)) {
         return new PlainServer();
      }
      if (mechanism.equals(Registry.SASL_ANONYMOUS_MECHANISM)) {
         return new AnonymousServer();
      }
      return null;
   }