internal static Message End(IAsyncResult result, out SecurityProtocolCorrelationState newCorrelationState)
            {
                GetOneTokenAndSetUpSecurityAsyncResult self = AsyncResult.End <GetOneTokenAndSetUpSecurityAsyncResult>(result);

                newCorrelationState = self.newCorrelationState;
                return(self.message);
            }
            static void GetTokenCompleteCallback(IAsyncResult result)
            {
                if (result == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("result");
                }
                if (result.CompletedSynchronously)
                {
                    return;
                }
                GetOneTokenAndSetUpSecurityAsyncResult self = result.AsyncState as GetOneTokenAndSetUpSecurityAsyncResult;

                if (self == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("result", SR.GetString(SR.InvalidAsyncResult));
                }
                Exception completionException = null;
                bool      completeSelf        = false;

                try
                {
                    SecurityToken token = self.provider.EndGetToken(result);
                    completeSelf = self.OnGetTokenComplete(token);
                }
#pragma warning suppress 56500 // covered by FxCOP
                catch (Exception e)
                {
                    // Always immediately rethrow fatal exceptions.
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }

                    completeSelf        = true;
                    completionException = e;
                }
                if (completeSelf)
                {
                    self.Complete(false, completionException);
                }
            }