예제 #1
0
        public void ExpectStxToDisposeThemselfWhenTheirEndTimerHasFired()
        {
            var s = new Mock<ISipMessageSender>();
            var l = new Mock<ISipListener>();
            var txTable = new SipServerTransactionTable();
            var tfsBuilder = new TimerFactoryStubBuilder();
            tfsBuilder.WithNonInviteStxEndCompletedTimerInterceptor((a) => new TxTimerStub(a, 1000, false, AfterCallBack));
            tfs = tfsBuilder.Build();
            for (int i = 0; i < Number; i++)
            {
                var r = new SipRequestBuilder().WithCSeq(new SipCSeqHeaderBuilder().WithSequence(i).Build()).Build();
                var stx = new SipNonInviteServerTransaction(txTable, r, l.Object, s.Object, tfs);

                /*go to completed state */
                stx.SendResponse(new SipResponseBuilder()
                    .WithStatusLine(new SipStatusLineBuilder()
                    .WithStatusCode(200)
                    .WithReason("OK")
                    .Build())
                    .Build());
            }

            /*wait for Number of timers to fire*/
            are.WaitOne();

            Assert.IsTrue(!txTable.AsEnumerable().Any());
        }
예제 #2
0
 public When_in_confirmed_state()
     : base()
 {
     var tf = new TimerFactoryStubBuilder();
     //tf.WithInviteStxEndConfirmedTimerInterceptor((a) => new TxTimerStub(a, 200, false, AfterCallBack));
     TimerFactory = tf.Build();
 }
 public When_in_proceeding_state_the_send_trying_timer_fired()
     : base()
 {
     var tf = new TimerFactoryStubBuilder();
     tf.WithInviteStxSendTryingTimerInterceptor((a) => new TxTimerStub(a, 200, false, AfterSendTryingFired));
     TimerFactory = tf.Build();
 }
 public When_in_completed_state_the_retransit_timer_fired_5_times()
     : base()
 {
     var tf = new TimerFactoryStubBuilder();
     _originalInterval = 500;
     tf.WithInviteStxRetransmitTimerInterceptor((a) => new TxTimerStub(a, _originalInterval, false, AfterRetransmitFired));
     TimerFactory = tf.Build();
 }
 public When_in_completed_state_the_endcompleted_timer_fired()
     : base()
 {
     var tf = new TimerFactoryStubBuilder();
     tf.WithInviteStxRetransmitTimerInterceptor((a) => new TxTimerStub(a, 500, false, ()=> { }));
     tf.WithInviteStxEndCompletedInterceptor((a) => new TxTimerStub(a, 64 * SipConstants.T1, false, AfterEndCompleted));
     TimerFactory = tf.Build();
 }
        public SipInviteClientDialogSpecificationBase()
        {
            _toTag = SipUtil.CreateTag();
            _fromTag = SipUtil.CreateTag();
            _callId = SipUtil.CreateCallId();
            _cSeq = 2;

            Sender = new Mock<ISipMessageSender>();
            Listener = new Mock<ISipListener>();
            DialogTable = new SipDialogTable();
            InvitingRequest = CreateInviteRequest();

            InviteCtx = new Mock<ISipClientTransaction>();
            InviteCtx.Setup((tx) => tx.Request).Returns(InvitingRequest);

            var tfb = new TimerFactoryStubBuilder();

            TimerFactory = tfb.Build();
        }
        public SipInviteServerDialogSpecificationBase()
        {
            _toTag = SipUtil.CreateTag();
            _fromTag = SipUtil.CreateTag();
            _callId = SipUtil.CreateCallId();
            _cSeq = 2;

            Sender = new Mock<ISipMessageSender>();
            Listener = new Mock<ISipListener>();
            DialogTable = new SipDialogTable();
            ReceivedRequest = CreateInviteRequest();

            InviteStx = new Mock<ISipServerTransaction>();
            InviteStx.Setup((tx) => tx.Request).Returns(ReceivedRequest);

            var tfb = new TimerFactoryStubBuilder()
               .WithInviteCtxRetransmitTimerInterceptor(OnCreateRetransmitOkTimer)
               .WithInviteCtxTimeOutTimerInterceptor(OnCreateTimeOutTimer);

            TimerFactory = tfb.Build();
        }
 public When_in_confirmed_state_the_endwaitforack_timer_has_fired()
 {
     var tfb = new TimerFactoryStubBuilder();
     tfb.WithInviteCtxTimeOutTimerInterceptor((a) => new TxTimerStub(a, SipConstants.T1, false, AfterEndWaitForAck));
     TimerFactory = tfb.Build();
 }
 public When_in_confirmed_state_a_resent_request_is_received()
     : base()
 {
     var tf = new TimerFactoryStubBuilder();
     TimerFactory = tf.Build();
 }