private static void GetTokenCompleteCallback(IAsyncResult result)
 {
     if (result == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("result");
     }
     if (!result.CompletedSynchronously)
     {
         MessageSecurityProtocol.GetOneTokenAndSetUpSecurityAsyncResult asyncState = result.AsyncState as MessageSecurityProtocol.GetOneTokenAndSetUpSecurityAsyncResult;
         if (asyncState == null)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("result", System.ServiceModel.SR.GetString("InvalidAsyncResult"));
         }
         Exception exception = null;
         bool      flag      = false;
         try
         {
             SecurityToken token = asyncState.provider.EndGetToken(result);
             flag = asyncState.OnGetTokenComplete(token);
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             flag      = true;
             exception = exception2;
         }
         if (flag)
         {
             asyncState.Complete(false, exception);
         }
     }
 }
 internal static Message End(IAsyncResult result, out SecurityProtocolCorrelationState newCorrelationState)
 {
     MessageSecurityProtocol.GetOneTokenAndSetUpSecurityAsyncResult result2 = AsyncResult.End <MessageSecurityProtocol.GetOneTokenAndSetUpSecurityAsyncResult>(result);
     newCorrelationState = result2.newCorrelationState;
     return(result2.message);
 }