txampext/multiplexing.py
def connect(self, factory):
        """Attempts to connect using a given factory.

        This will find the requested factory and use it to build a
        protocol as if the AMP protocol's peer was making the
        connection. It will create a transport for the protocol and
        connect it immediately. It will then store the protocol under
        a unique identifier, and return that identifier.

        """
        try:
            factory = self._factories[factory]
        except KeyError:
            raise NoSuchFactory()

        remote = self.getProtocol()
        addr = remote.transport.getPeer()
        proto = factory.buildProtocol(addr)
        if proto is None:
            raise ConnectionRefused()

        identifier = uuid4().hex
        transport = MultiplexedTransport(identifier, remote)
        proto.makeConnection(transport)

        self._protocols[identifier] = proto
        return {"connection": identifier}
def connect(self, factory):
        """Attempts to connect using a given factory.

        This will find the requested factory and use it to build a
        protocol as if the AMP protocol's peer was making the
        connection. It will create a transport for the protocol and
        connect it immediately. It will then store the protocol under
        a unique identifier, and return that identifier.

        """
        try:
            factory = self._factories[factory]
        except KeyError:
            raise NoSuchFactory()

        remote = self.getProtocol()
        addr = remote.transport.getPeer()
        proto = factory.buildProtocol(addr)
        if proto is None:
            raise ConnectionRefused()

        identifier = uuid4().hex
        transport = MultiplexedTransport(identifier, remote)
        proto.makeConnection(transport)

        self._protocols[identifier] = proto
        return {"connection": identifier}
Attempts to connect using a given factory.

        This will find the requested factory and use it to build a
        protocol as if the AMP protocol's peer was making the
        connection. It will create a transport for the protocol and
        connect it immediately. It will then store the protocol under
        a unique identifier, and return that identifier.