public void Serializes_Pdu()
        {
            var expectedResult = new byte[] {
                0x00, 0x00, 0x00, 0x17, // length
                0x80, 0x00, 0x00, 0x09, // command
                0x00, 0x00, 0x00, 0x00, // status
                0x00, 0x00, 0x00, 0x20, // sequence
                0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x00 // system ID
            };
            var pdu = new BindTransceiverResponse(
                SmppStatus.Ok,
                32,
                "System");
            var serializer = new BindTransceiverResponseSerializer();

            var result = serializer.Serialize(pdu);

            CollectionAssert.AreEqual(expectedResult, result);
        }
Example #2
0
        void IPduReceivedHandler.HandlePdu(BindTransceiverResponse 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.BoundTransceiver;
                task.SetResult(new BindResult(pdu.SystemId));
            }
        }