twisted.internet.protocol.ClientFactory.buildProtocol

Here are the examples of the python api twisted.internet.protocol.ClientFactory.buildProtocol taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

27 Examples 7

Example 1

Project: eth-proxy Source File: socksclient.py
Function: build_protocol
    def buildProtocol(self, addr):
        r=ClientFactory.buildProtocol(self, addr)
        r.postHandshakeEndpoint = self.postHandshakeEndpoint
        r.postHandshakeFactory = self.postHandshakeFactory
        r.handshakeDone = self.handshakeDone
        return r

Example 2

Project: mqtt_fuzz Source File: mqtt_fuzz.py
Function: build_protocol
    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

Example 3

Project: mqtt_fuzz Source File: reprotool.py
Function: build_protocol
    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

Example 4

Project: sparts Source File: twisted_chat.py
Function: build_protocol
    def buildProtocol(self, addr):
        proto = ClientFactory.buildProtocol(self, addr)
        proto.nickname = self.task.nickname
        proto.password = self.task.password
        proto.source_url = self.task.source_url
        return proto

Example 5

Project: txloadbalancer Source File: proxy.py
Function: build_protocol
    def buildProtocol(self, *args, **kw):
        """
        This method overrides the base class method, because we want to connect
        the objects together. Note that the setReseiver method that is called
        is from this factory's protocol, not from the factory itself.
        """
        protObj = protocol.ClientFactory.buildProtocol(self, *args, **kw)
        protObj.setReceiver(self.receiver)
        return protObj

Example 6

Project: twunnel Source File: local_proxy_server.py
Function: build_protocol
    def buildProtocol(self, *args, **kwargs):
        twunnel.logger.log(3, "trace: OutputProtocolFactory.buildProtocol")
        
        outputProtocol = protocol.ClientFactory.buildProtocol(self, *args, **kwargs)
        outputProtocol.inputProtocol = self.inputProtocol
        outputProtocol.inputProtocol.outputProtocol = outputProtocol
        return outputProtocol

Example 7

Project: twunnel Source File: local_proxy_server__https.py
Function: build_protocol
    def buildProtocol(self, *args, **kwargs):
        twunnel.logger.log(3, "trace: HTTPSInputProtocolFactory.buildProtocol")
        
        inputProtocol = protocol.ClientFactory.buildProtocol(self, *args, **kwargs)
        inputProtocol.configuration = self.configuration
        inputProtocol.outputProtocolConnectionManager = self.outputProtocolConnectionManager
        return inputProtocol

Example 8

Project: twunnel Source File: local_proxy_server__socks4.py
Function: build_protocol
    def buildProtocol(self, *args, **kwargs):
        twunnel.logger.log(3, "trace: SOCKS4InputProtocolFactory.buildProtocol")
        
        inputProtocol = protocol.ClientFactory.buildProtocol(self, *args, **kwargs)
        inputProtocol.configuration = self.configuration
        inputProtocol.outputProtocolConnectionManager = self.outputProtocolConnectionManager
        return inputProtocol

Example 9

Project: twunnel Source File: local_proxy_server__socks5.py
Function: build_protocol
    def buildProtocol(self, *args, **kwargs):
        twunnel.logger.log(3, "trace: SOCKS5InputProtocolFactory.buildProtocol")
        
        inputProtocol = protocol.ClientFactory.buildProtocol(self, *args, **kwargs)
        inputProtocol.configuration = self.configuration
        inputProtocol.outputProtocolConnectionManager = self.outputProtocolConnectionManager
        return inputProtocol

Example 10

Project: twunnel Source File: local_proxy_server__ssh.py
Function: build_protocol
    def buildProtocol(self, address):
        twunnel.logger.log(3, "trace: SSHClientTransportFactory.buildProtocol")
        
        p = protocol.ClientFactory.buildProtocol(self, address)
        p.configuration = self.configuration
        return p

Example 11

Project: twisted-socks Source File: socksclient.py
Function: build_protocol
    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

Example 12

Project: nagcat Source File: query_tcp.py
Function: build_protocol
    def buildProtocol(self, addr):
        # Setup timeout callback
        proto = protocol.ClientFactory.buildProtocol(self, addr)

        call_id = reactor.callLater(self.conf['timeout'], proto.timeout)
        self.deferred.addBoth(self._cancelTimeout, call_id)

        return proto

Example 13

Project: marionette Source File: channel.py
Function: build_protocol
    def buildProtocol(self, address):
        proto = protocol.ClientFactory.buildProtocol(self, address)
        channel = Channel(proto, "tcp")
        channel.party = "client"
        proto.channel = channel
        self.callback_(channel)
        return proto

Example 14

Project: ccs-calendarserver Source File: inbound.py
Function: build_protocol
    def buildProtocol(self, addr):
        p = protocol.ClientFactory.buildProtocol(self, addr)
        username = self.settings["Username"]
        p.registerAuthenticator(imap4.CramMD5ClientAuthenticator(username))
        p.registerAuthenticator(imap4.LOGINAuthenticator(username))
        p.registerAuthenticator(imap4.PLAINAuthenticator(username))
        return p

Example 15

Project: Python-RTSP Source File: rtsp.py
Function: build_protocol
    def buildProtocol(self, addr):
        p = protocol.ClientFactory.buildProtocol(self, addr)
        if self.timeout:
            timeoutCall = reactor.callLater(self.timeout, p.timeout)
            self.deferred.addBoth(self._cancelTimeout, timeoutCall)
        return p

Example 16

Project: vumi Source File: test_fake_smsc.py
Function: build_protocol
    def buildProtocol(self, addr):
        self.proto = ClientFactory.buildProtocol(self, addr)
        return self.proto

Example 17

Project: vertex Source File: test_ptcp.py
Function: build_protocol
    def buildProtocol(self, addr):
        p = protocol.ClientFactory.buildProtocol(self, addr)
        self.onConnect.callback(p)
        return p

Example 18

Project: vertex Source File: test_q2q.py
Function: build_protocol
    def buildProtocol(self, addr):
        result = protocol.ClientFactory.buildProtocol(self, addr)
        self.proto = result
        return result

Example 19

Project: khashmir Source File: airproxy.py
Function: build_protocol
    def buildProtocol(self, addr):
        p = protocol.ClientFactory.buildProtocol(self, addr)
        p.out = self.out
        p.out.out = p
        return p

Example 20

Project: Community-Zenpacks Source File: check_memcached.py
Function: build_protocol
    def buildProtocol(self, addr):    
        p = protocol.ClientFactory.buildProtocol(self, addr)
        p.persistentTimeOut = p.timeOut = self.memcachedTimeout
        return p

Example 21

Project: gemuo Source File: irc.py
Function: build_protocol
    def buildProtocol(self, addr):
        protocol = ClientFactory.buildProtocol(self, addr)
        protocol.nickname = self._client.world.player.name
        return protocol

Example 22

Project: PSO2Proxy Source File: ShipProxy.py
Function: build_protocol
    def buildProtocol(self, *args, **kw):
        the_protocol = protocol.ClientFactory.buildProtocol(self, *args, **kw)
        the_protocol.set_peer(self.server)
        return the_protocol

Example 23

Project: filesync-server Source File: ssl_proxy.py
Function: build_protocol
    def buildProtocol(self, addr):
        p = protocol.ClientFactory.buildProtocol(self, addr)
        return p

Example 24

Project: txsocksx Source File: test_client.py
Function: build_protocol
    def buildProtocol(self, addr):
        if self.returnNoProtocol:
            return None
        self.proto = protocol.ClientFactory.buildProtocol(self, addr)
        return self.proto

Example 25

Project: twisted-intro Source File: get-poetry-stack.py
Function: build_protocol
    def buildProtocol(self, address):
        proto = ClientFactory.buildProtocol(self, address)
        proto.task_num = self.task_num
        self.task_num += 1
        return proto

Example 26

Project: mythbox Source File: portforward.py
Function: build_protocol
    def buildProtocol(self, *args, **kw):
        prot = protocol.ClientFactory.buildProtocol(self, *args, **kw)
        prot.setPeer(self.server)
        return prot

Example 27

Project: pushproxy Source File: intercept.py
Function: build_protocol
    def buildProtocol(self, *args, **kw):
        prot = protocol.ClientFactory.buildProtocol(self, *args, **kw)
        prot.setPeer(self.deviceProtocol)
        prot.addHandlers(self.dispatchHandlers)
        return prot