public void Abort(AbortDetails details, string reason)
 {
     using (IDisposable proxy = mServerProxy as IDisposable)
     {
         TrySetCloseEventArgs(SessionCloseType.Abort, details, reason);
     }
 }
Exemple #2
0
        public void ExceptionOnAuthenticateRaisesAbort()
        {
            MockSessionAuthenticationFactory mockSessionAuthenticationFactory =
                new MockSessionAuthenticationFactory();

            WampPendingClientDetails authenticatorFactoryParameters = null;

            mockSessionAuthenticationFactory.SetGetSessionAuthenticator
                ((clientDetails, transportAuthenticator) =>
            {
                authenticatorFactoryParameters = clientDetails;
                MockSessionAuthenticator mockSessionAuthenticator = new MockSessionAuthenticator();
                mockSessionAuthenticator.SetAuthenticationMethod("ticket");

                mockSessionAuthenticator.SetAuthenticate((signature, extraData) => throw new WampAuthenticationException(new MyAbortDetails()
                {
                    Message = "aborted!", Year = 2015
                }, "com.myapp.abortreason"));

                return(mockSessionAuthenticator);
            });

            WampAuthenticationPlayground playground =
                new WampAuthenticationPlayground(mockSessionAuthenticationFactory);

            playground.Host.Open();

            string       clientReason       = null;
            AbortDetails clientAbortDetails = null;

            Mock <IWampClient <JToken> > clientMock = new Mock <IWampClient <JToken> >();

            clientMock.Setup(x => x.Abort(It.IsAny <AbortDetails>(), It.IsAny <string>()))
            .Callback((AbortDetails details, string reason) =>
            {
                clientReason       = reason;
                clientAbortDetails = details;
            });

            IWampServerProxy serverProxy =
                playground.CreateRawConnection(clientMock.Object);

            serverProxy.Hello("realm1", new HelloDetailsHack()
            {
                AuthenticationId      = "joe",
                AuthenticationMethods = new string[] { "wampcra", "ticket" }
            });

            serverProxy.Authenticate("Barack Hussein", new AuthenticateExtraData());

            Assert.That(clientReason, Is.EqualTo("com.myapp.abortreason"));
            Assert.That(clientAbortDetails.Message, Is.EqualTo("aborted!"));

            var deserialized =
                clientAbortDetails.OriginalValue.Deserialize <MyAbortDetails>();

            Assert.That(deserialized.Year, Is.EqualTo(2015));
        }
Exemple #3
0
        public virtual void Abort(IWampSessionClient client, AbortDetails details, string reason)
        {
            using (IDisposable disposable = client as IDisposable)
            {
                IWampClientProxy <TMessage> wampClient = client as IWampClientProxy <TMessage>;

                wampClient.GoodbyeSent = true;
                wampClient.Realm.Abort(wampClient.Session, details, reason);
            }
        }
 public void Abort(long session, AbortDetails details, string reason)
 {
     mRealmGate.Abort(session, details, reason);
 }
 public void Abort(IWampSessionClient client, AbortDetails details, string reason)
 {
     throw new System.NotImplementedException();
 }
 public virtual void Abort(IWampSessionClient client, AbortDetails details, string reason)
 {
 }
 public override void Abort(IWampSessionClient client, AbortDetails details, string reason)
 {
     Reason  = reason;
     Details = details;
 }
 public void Abort(AbortDetails details, string reason)
 {
     Send(mAbort2, details, reason);
 }
Exemple #9
0
 public void Abort(AbortDetails details, string reason)
 {
     RaiseConnectionBroken(SessionCloseType.Abort, details, reason);
 }
 public void Abort(long session, AbortDetails details, string reason)
 {
     RaiseSessionClosed(SessionCloseType.Abort, session, details, reason);
 }
 /// <summary>
 /// Initializes an new instance of <see cref="WampAuthenticationException"/>
 /// </summary>
 /// <param name="details">The details to send with the ABORT message.</param>
 /// <param name="reason">The reason to send with the ABORT message.</param>
 public WampAuthenticationException(AbortDetails details, string reason = WampErrors.WampErrorCannotAuthenticate)
     : base(details.Message)
 {
     mDetails = details;
     mReason  = reason;
 }
Exemple #12
0
 public void Abort(AbortDetails details, string reason)
 {
     SessionClient.Abort(details, reason);
 }
 public void Abort(AbortDetails details, string reason)
 {
     TrySetCloseEventArgs(SessionCloseType.Abort, details, reason);
     mServerProxy.Dispose();
 }
Exemple #14
0
 public void Abort(AbortDetails details, string reason)
 {
     TrySetCloseEventArgs(SessionCloseType.Abort, details, reason);
 }