/// <summary>sends AUTH command</summary>
        /// <remarks>valid in authorization state</remarks>
        public PopCommandResult Auth(SaslClientMechanism specificAuthenticationMechanism)
        {
            if (specificAuthenticationMechanism == null)
            throw new ArgumentNullException("specificAuthenticationMechanism");

              var ret = RejectNonConnectedOrGetAuthenticatedResult();

              if (ret != null)
            return ret;

              using (var t = new AuthTransaction(connection, specificAuthenticationMechanism)) {
            if (ProcessTransaction(t).Succeeded) {
              var authMechanism = PopAuthenticationMechanism.GetKnownOrCreate(specificAuthenticationMechanism.Name);
              var username = specificAuthenticationMechanism.Credential == null
            ? null
            : specificAuthenticationMechanism.Credential.UserName;

              UpdateAuthority(username, authMechanism);
              TransitStateTo(PopSessionState.Transaction);
            }

            return t.Result;
              }
        }
        /// <summary>sends AUTH command</summary>
        /// <remarks>valid in authorization state</remarks>
        public PopCommandResult Auth(ICredentialsByHost credentials, string username, PopAuthenticationMechanism authenticationMechanism)
        {
            if (credentials == null)
            throw new ArgumentNullException("credentials");
              if (authenticationMechanism == null)
            throw new ArgumentNullException("authenticationMechanism");

              var ret = RejectNonConnectedOrGetAuthenticatedResult();

              if (ret != null)
            return ret;

              // TODO: check Request.Arguments, not here
              if (handlesIncapableAsException)
            CheckServerCapability(authenticationMechanism);

              NetworkCredential credential;

              ret = LookupAppropriateCredential(credentials, username, authenticationMechanism, out credential);

              if (ret != null)
            return ret;

              using (var t = new AuthTransaction(connection, credential)) {
            t.RequestArguments["mechanism"] = (string)authenticationMechanism;

            if (ProcessTransaction(t).Succeeded) {
              UpdateAuthority(credential.UserName, authenticationMechanism);
              TransitStateTo(PopSessionState.Transaction);
            }

            return t.Result;
              }
        }