code: public static SessionFactory newSessionFactory (
          final Class<? extends Credentials> credsClass,
          final Class<? extends PresentsSession> sessionClass,
          final Class<? extends Name> nameClass,
          final Class<? extends ClientResolver> resolverClass)
      {
          return new SessionFactory() {
              @Override public Class<? extends PresentsSession> getSessionClass (AuthRequest areq) {
                  return credsClass.isInstance(areq.getCredentials()) ? sessionClass : null;
              }
              @Override
              public Class <? extends ClientResolver> getClientResolverClass (Name username) {
                  return nameClass.isInstance(username) ? resolverClass : null;
              }
          };
      }
docs: Creates a session factory that handles clients with the supplied credentials and
  authentication name.