public static final ClientMechanism getInstance(String mechanism) {
      if (mechanism == null) {
         return null;
      }
      mechanism = mechanism.trim().toUpperCase();
      if (mechanism.equals(Registry.SASL_SRP_MECHANISM)) {
         return new SRPClient();
      }
      if (mechanism.equals(Registry.SASL_CRAM_MD5_MECHANISM)) {
         return new CramMD5Client();
      }
      if (mechanism.equals(Registry.SASL_PLAIN_MECHANISM)) {
         return new PlainClient();
      }
      if (mechanism.equals(Registry.SASL_ANONYMOUS_MECHANISM)) {
         return new AnonymousClient();
      }
      return null;
   }