static void CreateNegotiationStateCallback(IAsyncResult result)
            {
                if (result.CompletedSynchronously)
                {
                    return;
                }
                SecurityNegotiationAsyncResult self = (SecurityNegotiationAsyncResult)result.AsyncState;
                bool      completeSelf        = false;
                Exception completionException = null;

                try
                {
                    self.negotiationState = self.tokenProvider.EndCreateNegotiationState(result);
                    completeSelf          = self.OnCreateStateComplete();
                    if (completeSelf)
                    {
                        self.OnNegotiationComplete();
                    }
                }
#pragma warning suppress 56500 // covered by FxCOP
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }

                    completeSelf        = true;
                    completionException = self.OnAsyncNegotiationFailure(e);
                }
                if (completeSelf)
                {
                    self.Complete(false, completionException);
                }
            }
            static void OpenChannelCallback(IAsyncResult result)
            {
                if (result.CompletedSynchronously)
                {
                    return;
                }
                SecurityNegotiationAsyncResult self = (SecurityNegotiationAsyncResult)result.AsyncState;
                bool      completeSelf        = false;
                Exception completionException = null;

                try
                {
                    self.rstChannel.EndOpen(result);
                    completeSelf = self.OnRequestChannelOpened();
                    if (completeSelf)
                    {
                        self.OnNegotiationComplete();
                    }
                }
#pragma warning suppress 56500 // covered by FxCOP
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }

                    completeSelf        = true;
                    completionException = self.OnAsyncNegotiationFailure(e);
                }
                if (completeSelf)
                {
                    self.Complete(false, completionException);
                }
            }
            static void SendRequestCallback(IAsyncResult result)
            {
                if (result.CompletedSynchronously)
                {
                    return;
                }
                SecurityNegotiationAsyncResult self = (SecurityNegotiationAsyncResult)result.AsyncState;
                bool      completeSelf        = false;
                Exception completionException = null;

                try
                {
                    Message incomingMessage = null;
                    try
                    {
                        incomingMessage = self.rstChannel.EndRequest(result);
                    }
                    finally
                    {
                        if (self.nextOutgoingMessage != null)
                        {
                            self.nextOutgoingMessage.Close();
                        }
                    }

                    using (incomingMessage)
                    {
                        if (incomingMessage == null)
                        {
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityNegotiationException(SR.GetString(SR.FailToRecieveReplyFromNegotiation)));
                        }
                        completeSelf = self.DoNegotiation(incomingMessage);
                    }

                    if (completeSelf)
                    {
                        self.OnNegotiationComplete();
                    }
                }
#pragma warning suppress 56500 // covered by FxCOP
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }

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