def test_SASLClient(self):
        """Test SASL Anonymous with Initiator"""

        factory = SASLAnonClientFactory()
        factory.addProfile(echoprofile)
        factory.addProfile(saslanonymousprofile)

        reactor.connectTCP('localhost', 1976, factory)
        reactor.run()

        if factory.reason:
            raise Exception(factory.reason.getErrorMessage())
示例#2
0
    def test_TLSClient(self):
        factory = TLSEchoClientFactory()
        factory.addProfile(echoprofile)
        factory.addProfile(tlsprofile)

        reactor.connectTCP("localhost", 1976, factory)
        reactor.run()

        log.debug("Finished reactor run")

        if factory.reason:
            log.debug("oh no! normal reason!")
            raise Exception(factory.reason.getErrorMessage())
示例#3
0
    def test_createSASLOTPSession(self):
        """Test SASL OTP with no CDATA init"""

        factory = SASLOTPClientFactory()
        factory.addProfile(echoprofile)
        factory.addProfile(saslotpprofile)

        #        log.debug("Reactor state: %s" % reactor.removeAll())

        reactor.connectTCP("localhost", 1976, factory)
        reactor.run()

        if factory.reason:
            log.error("Error occurred in factory: %s" % factory.reason)
            raise Exception(factory.reason.getErrorMessage())
示例#4
0
            log.debug('Echo channel started successfully.')
            channel = self.getChannel(channelnum)
            msgno = channel.sendMessage('Echo 1!')
            msgno = channel.sendMessage('Echo 2!')
            msgno = channel.sendMessage('Echo 3!')
            msgno = channel.sendMessage('Echo 4!')
            msgno = channel.sendMessage('Echo 5!')
            msgno = channel.sendMessage('Echo 6!')

        else:
            log.debug('Unknown channel created: %d' % channelnum)

    def authenticationSucceeded(self):
        log.debug('Authentication Succeeded!')
        self.echochannel = self.newChannel(echoprofile)

class SASLAnonClientFactory(SASLClientFactory):
    """ This is a short factory for echo clients
    """
    protocol = SASLAnonClientProtocol


if __name__ == '__main__':
    factory = SASLAnonClientFactory()
    factory.addProfile(echoprofile)
    factory.addProfile(saslotpprofile)

    reactor.connectTCP('localhost', 1976, factory)
    reactor.run()

示例#5
0
 def tearDown(self):
     self.client.terminate()
     reactor.iterate()
     reactor.stop()
     reactor.run()
示例#6
0
 def test_connect(self):
     """ Test a simple connection to a listening BEEP server
     """
     factory = InitiatorTestFactory()
     reactor.connectTCP('localhost', 1976, factory)
     reactor.run()