Esempio n. 1
0
 def buildProtocol(self, address):
     """ Overriden method to distinguish between the two protocols. """
     
     if address.port == 8888:
         self.protocol = DirectoryProtocol
         self.dirProto = ClientFactory.buildProtocol(self, address)
         return self.dirProto
     else:
         self.protocol = PeerProtocol
         return ClientFactory.buildProtocol(self, address)
Esempio n. 2
0
    def buildProtocol(self, address):
        """ Overriden method to distinguish between the two protocols. """

        if address.port == 8888:
            self.protocol = DirectoryProtocol
            self.dirProto = ClientFactory.buildProtocol(self, address)
            return self.dirProto
        else:
            self.protocol = PeerProtocol
            return ClientFactory.buildProtocol(self, address)
Esempio n. 3
0
    def testStor(self):
        # Connect
        client = ftp.FTPClient(passive=self.passive)
        client.debug = 1
        factory = ClientFactory()
        factory.noisy = 0
        factory.buildProtocol = lambda s, c=client: c
        reactor.connectTCP('localhost', self.ftp_port, factory)

        expectedContent = "Hello\n"*4
        
        def gotResult(c):
            c.write(expectedContent)
            c.finish()

        def gotErr(f):
            self.errback(f)

        t = client.storeFile("HelloThere")
        t[0].addCallbacks(gotResult, gotErr)
        t[1].addCallbacks(self.callback, self.errback)

        # Wait for a result
        id = reactor.callLater(5, self.errback, "timed out") # timeout so we don't freeze
        while not hasattr(self, 'result') and not hasattr(self, 'error'):
            reactor.iterate()
        try:
            id.cancel()
        except ValueError: pass

        error = getattr(self, 'error', None)
        if error:
            raise error[0], error[1], error[2]

        self.assertEquals(open('HelloThere').read(), expectedContent)
Esempio n. 4
0
    def testRetr(self):
        # Connect
        client = ftp.FTPClient(passive=self.passive)
        factory = ClientFactory()
        factory.noisy = 0
        factory.buildProtocol = lambda s, c=client: c
        reactor.connectTCP('localhost', self.ftp_port, factory)

        # download ftp_crap
        

        proto = BufferingProtocol()
        d = client.retr(os.path.basename('ftp_crap'), proto)
        d.addCallbacks(self.callback, self.errback)

        # Wait for a result
        id = reactor.callLater(5, self.errback, "timed out") # timeout so we don't freeze
        while not hasattr(self, 'result') and not hasattr(self, 'error'):
            reactor.iterate()
        try:
            id.cancel()
        except ValueError: pass

        error = getattr(self, 'error', None)
        if error:
            raise error[0], error[1], error[2]

        # Check that the file is the same as read directly off the disk
        self.failUnless(type(self.result) == types.ListType,
                        'callback result is wrong type: ' + str(self.result))
        data = proto.buf.getvalue()
        self.failUnless(data == open('ftp_crap', "rb").read(),
                        'RETRieved file does not match original')
Esempio n. 5
0
    def testShortFileListings(self):

        # Connect
        client = ftp.FTPClient(passive=self.passive)
        factory = ClientFactory()
        factory.noisy = 0
        factory.buildProtocol = lambda s, c=client: c
        reactor.connectTCP('localhost', self.ftp_port, factory)

        # Issue the command and set the callbacks
        p = BufferingProtocol()
        d = client.nlst('.', p)
        d.addCallbacks(self.callback, self.errback)

        # Wait for the result
        id = reactor.callLater(5, self.errback, "timed out") # timeout so we don't freeze
        while not hasattr(self, 'result') and not hasattr(self, 'error'):
            reactor.iterate()
        try:
            id.cancel()
        except ValueError: pass

        error = getattr(self, 'error', None)
        if error:
            raise error[0], error[1], error[2]

        # Check that the listing contains this file (ftp_crap)
        filenames = p.buf.getvalue().split('\r\n')
        self.failUnless('ftp_crap' in filenames,
                        'ftp_crap not in file listing')
Esempio n. 6
0
 def buildProtocol(self, addr):
     """
     Instantiate sub protocol.
     """
     p = ClientFactory.buildProtocol(self, addr)
     p.initialAction = self.deferreds.pop(0)
     return p
Esempio n. 7
0
class SpdyProtocolTest(TestCase):
    def setUp(self):
        self.factory = ClientFactory()
        self.factory.protocol = spdy.SpdyProtocol
        self.proto = self.factory.buildProtocol(('127.0.0.1', 0))
        self.tr = proto_helpers.StringTransport()
        self.proto.makeConnection(self.tr)

    def tearDown(self):
        return self.tr.loseConnection()
    
    def send(self, data):
        self.proto.dataReceived(data)    

    def testExampleFrames(self):
        called = []
        def request(streamId, headers):
            called.append(None)
            self.assertEqual(1, streamId)
            self.assertEqual('GET', headers.getRawHeaders('method')[0])
        self.proto.requestFactory = request
        self.send(example_frames)
        self.assertEqual(1, len(called))
        
                
Esempio n. 8
0
 def buildProtocol(self, addr):
     """Provision protocol with the dedicated logger
     """
     proto = ClientFactory.buildProtocol(self, addr)
     proto.log = self.log
     
     return proto
Esempio n. 9
0
    def buildProtocol(self, addr):
        """Provision protocol with the dedicated logger
        """
        proto = ClientFactory.buildProtocol(self, addr)
        proto.log = self.log

        return proto
Esempio n. 10
0
    def test_send_peh_upon_connection(self):
        '''To test client protocol we isloate it from the ClientFactory'''
        with patch.object(datetime, 'datetime', Mock(wraps=datetime.datetime)) as patched:
            fixed_date = datetime.datetime(2014, 1, 1, 12, 0, 0)
            patched.now.return_value = fixed_date

            factory = ClientFactory()
            factory.comaster = self.comaster

            factory.protocol = MaraClientProtocol
            proto = factory.buildProtocol(('127.0.0.1', 0))
            proto.construct = MaraFrame

            # Disable unnesesary behaviour
            def stop():
                proto.stop()
                reactor.stop()
            proto.sendPoll = MagicMock(side_effect=stop)

            transport = proto_helpers.StringTransport()
            proto.makeConnection(transport)

            bytes_sent_to_device = transport.value()
            result = MaraFrame.parse(bytes_sent_to_device)
            self.assertEqual(result.dest, 0xFF)
            self.assertEqual(result.source, 2)

            # We don't need to check BCC since it's already coded into MaraFrame
            self.assertEqual(result.peh, fixed_date)

            reactor.run()
            # Shuld have stopped
            self.assertEqual(self.comaster.update_peh_timestamp.call_count, 1)
            self.assertEqual(self.comaster.update_peh_timestamp.call_args[0][0],
                             fixed_date)
Esempio n. 11
0
 def buildProtocol(self, address):
     logger.vdebug(
         "Building protocol in StarboundClientFactory to address %s",
         address)
     protocol = ClientFactory.buildProtocol(self, address)
     protocol.server_protocol = self.server_protocol
     return protocol
Esempio n. 12
0
 def buildProtocol(self, addr):
     p = ClientFactory.buildProtocol(self, addr)
     if not hasattr(self,'deferred'):
         self.deferred = defer.Deferred()
     self.reactor.callLater(0, self.deferred.callback, p)
     del self.deferred
     return p
Esempio n. 13
0
File: irc.py Progetto: ojii/bottu
 def buildProtocol(self, addr):
     log.msg("Building protocol for %r" % addr)
     proto = ClientFactory.buildProtocol(self, addr)
     proto.app = self.app
     self.proto = proto
     self.join.ready()
     return proto
    def test_connectTCP(self):
        """
        Called on the object returned by L{loggedReactor}, C{connectTCP} calls
        the wrapped reactor's C{connectTCP} method with the original factory
        wrapped in a L{_TrafficLoggingFactory}.
        """
        class RecordDataProtocol(Protocol):
            def dataReceived(self, data):
                self.data = data

        proto = RecordDataProtocol()
        factory = ClientFactory()
        factory.protocol = lambda: proto
        reactor = MemoryReactor()
        logged = loggedReactor(reactor)
        logged.connectTCP('192.168.1.2', 1234, factory, 21, '127.0.0.2')
        [(host, port, factory, timeout, bindAddress)] = reactor.tcpClients
        self.assertEqual('192.168.1.2', host)
        self.assertEqual(1234, port)
        self.assertIsInstance(factory, _TrafficLoggingFactory)
        self.assertEqual(21, timeout)
        self.assertEqual('127.0.0.2', bindAddress)

        # Verify that the factory and protocol specified are really being used
        protocol = factory.buildProtocol(None)
        protocol.makeConnection(None)
        protocol.dataReceived("foo")
        self.assertEqual(proto.data, "foo")
    def test_connectTCP(self):
        """
        Called on the object returned by L{loggedReactor}, C{connectTCP} calls
        the wrapped reactor's C{connectTCP} method with the original factory
        wrapped in a L{_TrafficLoggingFactory}.
        """
        class RecordDataProtocol(Protocol):
            def dataReceived(self, data):
                self.data = data
        proto = RecordDataProtocol()
        factory = ClientFactory()
        factory.protocol = lambda: proto
        reactor = MemoryReactor()
        logged = loggedReactor(reactor)
        logged.connectTCP('192.168.1.2', 1234, factory, 21, '127.0.0.2')
        [(host, port, factory, timeout, bindAddress)] = reactor.tcpClients
        self.assertEqual('192.168.1.2', host)
        self.assertEqual(1234, port)
        self.assertIsInstance(factory, _TrafficLoggingFactory)
        self.assertEqual(21, timeout)
        self.assertEqual('127.0.0.2', bindAddress)

        # Verify that the factory and protocol specified are really being used
        protocol = factory.buildProtocol(None)
        protocol.makeConnection(None)
        protocol.dataReceived("foo")
        self.assertEqual(proto.data, "foo")
    def new_protocol_tcp(self):
        """
        Create a new client protocol connected to the server.
        :returns: a IRelayTestClient implementation
        """
        server_factory = ServerFactory()
        server_factory.protocol = TransitConnection
        server_factory.transit = self._transit_server
        server_factory.log_requests = self.log_requests
        server_protocol = server_factory.buildProtocol(('127.0.0.1', 0))

        @implementer(IRelayTestClient)
        class TransitClientProtocolTcp(Protocol):
            """
            Speak the transit client protocol used by the tests over TCP
            """
            _received = b""
            connected = False

            # override Protocol callbacks

            def connectionMade(self):
                self.connected = True
                return Protocol.connectionMade(self)

            def connectionLost(self, reason):
                self.connected = False
                return Protocol.connectionLost(self, reason)

            def dataReceived(self, data):
                self._received = self._received + data

            # IRelayTestClient

            def send(self, data):
                self.transport.write(data)

            def disconnect(self):
                self.transport.loseConnection()

            def reset_received_data(self):
                self._received = b""

            def get_received_data(self):
                return self._received

        client_factory = ClientFactory()
        client_factory.protocol = TransitClientProtocolTcp
        client_protocol = client_factory.buildProtocol(('127.0.0.1', 31337))

        pump = iosim.connect(
            server_protocol,
            iosim.makeFakeServer(server_protocol),
            client_protocol,
            iosim.makeFakeClient(client_protocol),
        )
        pump.flush()
        self._pumps.append(pump)
        return client_protocol
Esempio n. 17
0
 def buildProtocol(self, address):
     logger.vdebug(
         'Building protocol in StarboundClientFactory to address %s',
         address
     )
     protocol = ClientFactory.buildProtocol(self, address)
     protocol.server_protocol = self.server_protocol
     return protocol
Esempio n. 18
0
 def buildProtocol(self, addr):
     r = ClientFactory.buildProtocol(self, addr)
     r.postHandshakeEndpoint = self.postHandshakeEndpoint
     r.postHandshakeFactory = self.postHandshakeFactory
     r.handshakeDone = self.handshakeDone
     r._timestamps = self._timestamps
     r._timer = self._timer
     return r
Esempio n. 19
0
 def buildProtocol(self, addr):
     p = ClientFactory.buildProtocol(self, addr)
     p.followRedirect = self.followRedirect
     p.afterFoundGet = self.afterFoundGet
     if self.timeout:
         timeoutCall = reactor.callLater(self.timeout, p.timeout)
         self.deferred.addBoth(self._cancelTimeout, timeoutCall)
     return p
Esempio n. 20
0
 def buildProtocol(self, addr):
     r = ClientFactory.buildProtocol(self, addr)
     r.postHandshakeEndpoint = self.postHandshakeEndpoint
     r.postHandshakeFactory = self.postHandshakeFactory
     r.handshakeDone = self.handshakeDone
     r._timestamps = self._timestamps
     r._timer = self._timer
     return r
Esempio n. 21
0
    def buildProtocol(self, addr):
        """Provision protocol
        """
        proto = ClientFactory.buildProtocol(self, addr)

        # Setup logger
        proto.log = self.log
        
        return proto
Esempio n. 22
0
    def buildProtocol(self, addr):
        """Provision protocol
        """
        proto = ClientFactory.buildProtocol(self, addr)

        # Setup logger
        proto.log = self.log

        return proto
Esempio n. 23
0
 def makeProto(self, *a, **kw):
     protoClass = kw.pop('_protoClass', self.protocol)
     fac = ClientFactory(*a, **kw)
     fac.protocol = protoClass
     proto = fac.buildProtocol(None)
     transport = proto_helpers.StringTransport()
     transport.abortConnection = lambda: None
     proto.makeConnection(transport)
     return fac, proto
Esempio n. 24
0
 def buildProtocol(self, address):
     '''set up connection protocol
     override method from ClientFactory.buildProtocol
     does not meet pylint spec for name, exclude'''
     #if address not in SOURCE_LIST: SOURCE_LIST.append(address)
     #if address not in CONNECTED_LIST: CONNECTED_LIST.append(address)
     proto = ClientFactory.buildProtocol(self, address)
     proto.task_num = self.task_num
     self.task_num += 1
     return proto
Esempio n. 25
0
    def buildProtocol(self, addr):
        p = ClientFactory.buildProtocol(self, addr)

        #give SideServer his b_side
        self.a_side.set_b_side(p)

        d = self.converter.get_a_side(p)
        # later set ASideSession to be a_side
        d.addCallback(p.set_other_side)
        return p
Esempio n. 26
0
    def buildProtocol(self, addr):
        p = ClientFactory.buildProtocol(self, addr)

        #give SideServer his b_side
        self.a_side.set_b_side(p)

        d = self.converter.get_a_side(p)
        # later set ASideSession to be a_side
        d.addCallback(p.set_other_side)
        return p
    def buildProtocol(self, address):
        self._connectedProtocol = ClientFactory.buildProtocol(self, address)

        if self._config != None: 
            self._connectedProtocol.configure(**self._config)

        while len(self._queue) > 0:
            args = self._queue.pop()
            self._connectedProtocol.sendMessage(*args)

        return self._connectedProtocol
Esempio n. 28
0
    def buildProtocol(self, addr):
        proto = _ClientFactory.buildProtocol(self, addr)

        proto.scheme = self.scheme
        proto.host = self.host
        proto.port = self.port

        if self.timeout is not None:
            proto.setTimeout(self.timeout)

        return proto
Esempio n. 29
0
 def sbRequestAccepted((host, port, key)):
     LogEvent(INFO, self.ident)
     self.key = key
     self.reply = 0
     factory = ClientFactory()
     factory.buildProtocol = lambda addr: self
     self.msncon.connectors.append(
         reactor.connectTCP(host,
                            port,
                            factory,
                            bindAddress=(MSNConnection.BINDADDRESS, 0)))
Esempio n. 30
0
    def buildProtocol(self, address):
        # Create the fuzzer instance
        protocol_instance = ClientFactory.buildProtocol(self, address)

        # Tell the fuzzer instance which type of session it should run
        protocol_instance.current_session = iter(self.session.next())
        protocol_instance.fuzzdata = self.fuzzdata
        protocol_instance.session_id = str(uuid.uuid4())
        protocol_instance.fuzz_ratio = self.fuzz_ratio
        protocol_instance.send_delay = self.send_delay
        protocol_instance.validcases_path = self.validcases_path
        return protocol_instance
Esempio n. 31
0
 def makeProto(self, *a, **kw):
     protoClass = kw.pop('_protoClass', self.protocol)
     fac = ClientFactory(*a, **kw)
     fac.protocol = protoClass
     def raise_(ex):
         raise ex
     fac.bobConnectionFailed = lambda reason: raise_(reason)
     proto = fac.buildProtocol(None)
     transport = proto_helpers.StringTransport()
     transport.abortConnection = lambda: None
     proto.makeConnection(transport)
     return fac, proto
Esempio n. 32
0
    def buildProtocol(self, address):
        # Create the fuzzer instance
        protocol_instance = ClientFactory.buildProtocol(self, address)

        # Tell the fuzzer instance which type of session it should run
        protocol_instance.current_session = iter(self.session.next())
        protocol_instance.fuzzdata = self.fuzzdata
        protocol_instance.session_id = str(uuid.uuid4())
        protocol_instance.fuzz_ratio = self.fuzz_ratio
        protocol_instance.send_delay = self.send_delay
        protocol_instance.validcases_path = self.validcases_path
        return protocol_instance
Esempio n. 33
0
 def buildProtocol(self, addr):
     """
     Instantiate sub protocol.
     """
     if self.nodePortNumber == 0:
         raise RuntimeError("Local node number not set")
     p = ClientFactory.buildProtocol(self, addr)
     p.initialAction = ("alive2Request",
                        self.nodePortNumber,
                        self.nodeType,
                        self.distrVSNRange,
                        self.nodeName.split("@")[0])
     return p
Esempio n. 34
0
 def makeProto(self, *a, **kw):
     protoClass = kw.pop('_protoClass', self.protocol)
     fac = ClientFactory(*a, **kw)
     fac.protocol = protoClass
     fac.options = {}
     def raise_(ex):
         raise ex
     fac.bobConnectionFailed = lambda reason: raise_(reason)
     proto = fac.buildProtocol(None)
     transport = proto_helpers.StringTransport()
     transport.abortConnection = lambda: None
     proto.makeConnection(transport)
     return fac, proto
Esempio n. 35
0
 def connectReply(self, host, port, key, sessionID):
     LogEvent(INFO, self.ident)
     self.ready = False
     self.key = key
     self.sessionID = sessionID
     self.reply = 1
     factory = ClientFactory()
     factory.buildProtocol = lambda addr: self
     self.msncon.connectors.append(
         reactor.connectTCP(host,
                            port,
                            factory,
                            bindAddress=(MSNConnection.BINDADDRESS, 0)))
Esempio n. 36
0
    def buildProtocol(self, address):
        # Create a object of the Protocol
        # The returned instance will handle input on an incoming server
        # connection, and an attribute "factory" pointing to the creating
        # factory.

        # Alternatively, L{None} may be returned to immediately close the
        # new connection.

        # Call the base-class's buildProtocol since our Protocol is basic
        proto = ClientFactory.buildProtocol(self, address)
        proto.task_num = self.task_num  # Assign the new protocol its id
        self.task_num += 1  # Increment the id
        return proto  # Return the built protocol
Esempio n. 37
0
 def makeProto(self, *a, **kw):
     protoClass = kw.pop('_protoClass', self.protocol)
     fac = ClientFactory(*a, **kw)
     fac.nickname = 'foo'
     fac.privKey = None
     fac.options = {}
     fac.protocol = protoClass
     fac.resultNotOK = Mock()
     def raise_(ex):
         raise ex
     fac.connectionFailed = lambda reason: raise_(reason)
     proto = fac.buildProtocol(None)
     transport = proto_helpers.StringTransport()
     transport.abortConnection = lambda: None
     proto.makeConnection(transport)
     return fac, proto
Esempio n. 38
0
    def buildProtocol(self, address):
        # Create the fuzzer instance
        protocol_instance = ClientFactory.buildProtocol(self, address)
        if self.valid_connect:
            protocol_instance.dont_fuzz = ['connect']
        else:
            protocol_instance.dont_fuzz = []

        # Tell the fuzzer instance which type of session it should run
        protocol_instance.current_session = itertools.cycle(next(self.session))
        protocol_instance.fuzzdata = self.fuzzdata
        protocol_instance.session_id = str(uuid.uuid4())
        protocol_instance.fuzz_ratio = self.fuzz_ratio
        protocol_instance.send_delay = self.send_delay
        protocol_instance.validcases_path = self.validcases_path
        return protocol_instance
Esempio n. 39
0
    def buildProtocol(self, address):
        """Build protocol and store it in this instance."""
        proto = ClientFactory.buildProtocol(self, address)
        self.connectedProtocol = proto
        return proto

        def connectionLost(self, reason):
            """Handle connection loss."""
        self.connectedProtocol = None
        feed.log('ANDROIDSENSORCLIENTFACTORY-connectionLost','%d - Connection to sensor %s was terminated: %s' % time.time(), self.sensor, reason.getErrorMessage())

        def clientConnectionFailed(self, connector, reason):
            """Handle a failed connection attempt to the sensor."""
        if not self.deferred is None:
            d, self.deferred = self.deferred, None
            d.errback(Failure(Exception('Connection to %s sensor failed' % self.sensor)))
        else:
            contextmonkeyreactor.stop()
            raise SystemError('The connection attempt to %s sensor failed more than once. Check if emulator is running' % self.sensor)
Esempio n. 40
0
File: util.py Progetto: sajith/txi2p
    def makeProto(self, *a, **kw):
        protoClass = kw.pop('_protoClass', self.protocol)
        fac = ClientFactory(*a, **kw)
        fac.nickname = 'foo'
        fac.privKey = None
        fac.port = None
        fac.localPort = None
        fac.options = {}
        fac.sigType = None
        fac.protocol = protoClass
        fac.resultNotOK = Mock()

        def raise_(reason):
            raise reason.value

        fac.connectionFailed = lambda reason: raise_(reason)
        proto = fac.buildProtocol(None)
        transport = proto_helpers.StringTransport()
        transport.abortConnection = lambda: None
        proto.makeConnection(transport)
        return fac, proto
Esempio n. 41
0
    def buildProtocol(self, addr):
        conn = addr.host, addr.port

        result = ClientFactory.buildProtocol(self, addr)
        result.other_side = conn

        def on_connect():
            """This callback will be called when actual connection happened."""
            self._all_connections.append(result)

            if addr.port in map(itemgetter(1), self.neighbours):
                self.log.info('Connected to another server: %s:%s' % conn)
                self.add_connection(result)
            else:
                self.log.info('Connection from another server accepted: %s:%s' % conn)

        def on_disconnect():
            self.remove_connection(result)

        result.on_connect = on_connect
        result.on_disconnect = on_disconnect
        return result
Esempio n. 42
0
    def buildProtocol(self, addr):
        conn = addr.host, addr.port

        result = ClientFactory.buildProtocol(self, addr)
        result.other_side = conn

        def on_connect():
            """This callback will be called when actual connection happened."""
            self._all_connections.append(result)

            if addr.port in map(itemgetter(1), self.neighbours):
                self.log.info('Connected to another server: %s:%s' % conn)
                self.add_connection(result)
            else:
                self.log.info(
                    'Connection from another server accepted: %s:%s' % conn)

        def on_disconnect():
            self.remove_connection(result)

        result.on_connect = on_connect
        result.on_disconnect = on_disconnect
        return result
Esempio n. 43
0
 def buildProtocol(self, addr):
     protocol = ClientFactory.buildProtocol(self, addr)
     protocol.wrapper = self.get_wrapper()
     return protocol
Esempio n. 44
0
 def buildProtocol(self, addr):
     self.connection = ClientFactory.buildProtocol(self, addr)
     print("connection in client is:",self.connection)
     return self.connection
Esempio n. 45
0
 def buildProtocol(self, address):
     # Create the fuzzer instance
     protocol_instance = ClientFactory.buildProtocol(self, address)
     # Tell the fuzzer instance which type of session it should run
     protocol_instance.session_id = str(uuid.uuid4())
     return protocol_instance
Esempio n. 46
0
 def buildProtocol(self, address):
     protocol = ClientFactory.buildProtocol(self, address)
     protocol.server_protocol = self.server_protocol
     return protocol
Esempio n. 47
0
 def buildProtocol(self, addr):
     self.delayed = reactor.callLater(5, self._connected_successfully)
     return ClientFactory.buildProtocol(self, addr)
Esempio n. 48
0
 def buildProtocol(self, addr):
     p = ClientFactory.buildProtocol(self, addr)
     #This is a sneaky way of passing the protocol instance back to the caller
     reactor.callLater(0, self.buildProtocolDeferred.callback, p)
     return p
Esempio n. 49
0
 def buildProtocol(self, addr):
     self.delayed = reactor.callLater(5, self._connected_successfully)
     return ClientFactory.buildProtocol(self, addr)
Esempio n. 50
0
 def buildProtocol(self, addr):
     p = ClientFactory.buildProtocol(self, addr)
     #This is a sneaky way of passing the protocol instance back to the caller
     #pylint: disable=no-member
     reactor.callLater(0, self.buildProtocolDeferred.callback, p)
     return p
Esempio n. 51
0
 def buildProtocol(self, address):
     protocol = ClientFactory.buildProtocol(self, address)
     protocol.server_protocol = self.server_protocol
     return protocol
Esempio n. 52
0
 def buildProtocoll(self, addr):
     proto = ClientFactory.buildProtocol(self, addr)
     return proto
Esempio n. 53
0
	def buildProtocol(self, address):
		proto = ClientFactory.buildProtocol(self, address);
		self.connectedProtocol = proto;
		return proto;
Esempio n. 54
0
 def buildProtocol(self, *args, **kw):
     prot = ClientFactory.buildProtocol(self, *args, **kw)
     prot.server = self.server
     return prot
Esempio n. 55
0
    def buildProtocol(self, addr):
        prot = ClientFactory.buildProtocol(self, addr)
        prot.config = self.config

        return prot
Esempio n. 56
0
 def buildProtocol(self, address):
     proto = ClientFactory.buildProtocol(self, address)
     proto.task_num = self.task_num
     self.task_num += 1
     return proto
Esempio n. 57
0
 def buildProtocol(self, address):
     proto = ClientFactory.buildProtocol(self, address)
     proto.task_num = self.task_num
     self.task_num += 1
     return proto
Esempio n. 58
0
 def buildProtocol(self, addr):
     protocol = ClientFactory.buildProtocol(self, addr)
     protocol.wrapper = self.get_wrapper()
     return protocol