Beispiel #1
0
 def __unbind(self):
     if self.state in ['BOUND_TX', 'BOUND_RX', 'BOUND_TRX']:
         pdu = Unbind(self.sequence_number)
         self.conn.send(pdu.get_bin())
         self.sequence_number += 1
         if self.__is_ok(self.__recv(), 'unbind_resp'):
             self.state = 'OPEN'
Beispiel #2
0
 def test_handle_unbind(self):
     protocol = yield self.get_protocol()
     yield self.fake_smsc.bind()
     self.assertEqual(protocol.state, EsmeProtocol.BOUND_STATE_TRX)
     self.fake_smsc.send_pdu(Unbind(0))
     pdu = yield self.fake_smsc.await_pdu()
     self.assertCommand(
         pdu, 'unbind_resp', sequence_number=0, status='ESME_ROK')
     # We don't change state here.
     self.assertEqual(protocol.state, EsmeProtocol.BOUND_STATE_TRX)
Beispiel #3
0
    def test_handle_unbind(self):
        """
        If the SMSC sends an unbind command, we respond and disconnect.
        """
        service = yield self.get_service()
        yield self.fake_smsc.bind()

        self.assertEqual(service.is_bound(), True)
        self.fake_smsc.send_pdu(Unbind(7))
        unbind_resp_pdu = yield self.fake_smsc.await_pdu()
        self.assertEqual(command_id(unbind_resp_pdu), 'unbind_resp')
        self.assertEqual(service.is_bound(), False)
Beispiel #4
0
    def test_auto_unbind(self):
        """
        FakeSMSC will automatically respond to an unbind request by default.
        The unbind PDU remains in the queue.
        """
        fake_smsc = FakeSMSC()
        client = self.successResultOf(self.connect(fake_smsc))
        self.assertEqual(client.received, b"")
        self.assertEqual(fake_smsc.waiting_pdu_count(), 0)

        yield client.write(Unbind(7).get_bin())
        self.assertEqual(client.received, UnbindResp(7).get_bin())
        self.assertEqual(fake_smsc.waiting_pdu_count(), 1)
Beispiel #5
0
 def unbind(self):
     sequence_number = yield self.sequence_generator.next()
     self.send_pdu(Unbind(sequence_number))
     returnValue([sequence_number])
Beispiel #6
0
 def unbind(self):
     sequence_number = yield self.sequence_generator.next()
     self.send_pdu(Unbind(sequence_number))
     yield self.service.on_smpp_unbinding()
     returnValue([sequence_number])
Beispiel #7
0
    def test_unbind(self):
        esme = yield self.get_esme()

        yield esme.handle_data(Unbind(1).get_bin())

        self.assertEqual(False, esme.transport.connected)
Beispiel #8
0
 def test_handle_unbind(self):
     transport, protocol = yield self.setup_bind()
     protocol.dataReceived(Unbind(sequence_number=0).get_bin())
     [pdu] = yield wait_for_pdus(transport, 1)
     self.assertCommand(pdu, 'unbind_resp',
                        sequence_number=0, status='ESME_ROK')