public void Serializes_Pdu()
        {
            var expectedResult = new byte[] {
                0x00, 0x00, 0x00, 0x10, // length
                0x80, 0x00, 0x00, 0x06, // command
                0x00, 0x00, 0x00, 0x00, // status
                0x00, 0x00, 0x00, 0x20, // sequence
            };
            var pdu = new UnbindResponse(
                SmppStatus.Ok,
                32);
            var serializer = new UnbindResponseSerializer();

            var result = serializer.Serialize(pdu);

            CollectionAssert.AreEqual(expectedResult, result);
        }
Exemple #2
0
        void IPduReceivedHandler.HandlePdu(UnbindResponse pdu)
        {
            var task = _taskRegistry.Unregister(pdu.SequenceNumber);
            if (task == null)
                return;

            if (pdu.Status != SmppStatus.Ok)
            {
                var unbindException = new Exception("The unbind operation failed with error code: " + pdu.Status);
                task.SetException(unbindException);
            }
            else
            {
                _state = SessionState.Open;
                task.SetResult(true);
            }
        }
Exemple #3
0
 void IPduReceivedHandler.HandlePdu(Unbind pdu)
 {
     var response = new UnbindResponse(SmppStatus.Ok, pdu.SequenceNumber);
     _pduSender.Enqueue(response);
     // TODO: cancel outstanding tasks
     _state = SessionState.Open;
 }