Exemplo n.º 1
0
class LobbyClient(object):
    def __init__(self):
        certificate, key_file = init_certificates()
        self.ctx_factory = VerifyingClientContextFactory(certificate, key_file)
        self.factory = LobbyClientFactory()

    def loadServerCertificate(self, certificate):
        self.ctx_factory.loadAllowedCertificate(certificate)

    def connectSSL(self, server, port):
        reactor.connectSSL(server, int(port), self.factory, self.ctx_factory)

    def run(self, message=None):
        if message:
            self.factory.addMessageToQueue(message)
        reactor.run()
        self._received_data = self.factory.received_data

    def addMessageToQueue(self, message, dieAfterReply=False):
        self.factory.addMessageToQueue(message, dieAfterReply)
Exemplo n.º 2
0
 def __init__(self):
     certificate, key_file = init_certificates()
     self.ctx_factory = VerifyingClientContextFactory(certificate, key_file)
     self.factory = LobbyClientFactory()