@defer.inlineCallbacks
    def test_messaging_tx_and_rx(self):

        # Init a second client
        smppc2_config = copy.deepcopy(self.smppc_config)
        smppc2_factory = LastProtoSMPPClientFactory(smppc2_config)

        # First client is transmitter
        self.smppc_config.bindOperation = 'transmitter'
        # Second client is receiver
        smppc2_config.bindOperation = 'receiver'

        # Connect and bind both clients
        yield self.smppc_factory.connectAndBind()
        self.assertEqual(self.smppc_factory.smpp.sessionState, SMPPSessionStates.BOUND_TX)
        yield smppc2_factory.connectAndBind()
        self.assertEqual(smppc2_factory.smpp.sessionState, SMPPSessionStates.BOUND_RX)

        # Install mockers
        self.smppc_factory.lastProto.PDUReceived = mock.Mock(wraps=self.smppc_factory.lastProto.PDUReceived)
        smppc2_factory.lastProto.PDUReceived = mock.Mock(wraps=smppc2_factory.lastProto.PDUReceived)

        # SMPPServer > SMPPClient
        yield self.smpps_factory.lastProto.sendDataRequest(self.DeliverSmPDU)

        # Wait
        yield waitFor(1)

        # Unbind & Disconnect both clients
        yield self.smppc_factory.smpp.unbindAndDisconnect()
        self.assertEqual(self.smppc_factory.smpp.sessionState, SMPPSessionStates.UNBOUND)
        yield smppc2_factory.smpp.unbindAndDisconnect()
        self.assertEqual(smppc2_factory.smpp.sessionState, SMPPSessionStates.UNBOUND)

        # Asserts, DeliverSm must be sent to the BOUND_RX client
        self.assertEqual(self.smppc_factory.lastProto.PDUReceived.call_count, 1)
        self.assertEqual(smppc2_factory.lastProto.PDUReceived.call_count, 2)
        self.assertEqual(smppc2_factory.lastProto.PDUReceived.call_args_list[0][0][0].params['source_addr'],
                            self.DeliverSmPDU.params['source_addr'])
        self.assertEqual(smppc2_factory.lastProto.PDUReceived.call_args_list[0][0][0].params['destination_addr'],
                            self.DeliverSmPDU.params['destination_addr'])
        self.assertEqual(smppc2_factory.lastProto.PDUReceived.call_args_list[0][0][0].params['short_message'],
                            self.DeliverSmPDU.params['short_message'])
Send a deliver_sm to RX client only
dataset/ETHPy150Open jookies/jasmin/jasmin/protocols/smpp/test/test_smpp_server.py/MessagingTestCases.test_messaging_tx_and_rx