def connectQ2Q(self, fromAddress, toAddress,
                   protocolName, protocolFactory,
                   chooser=lambda x: x or [x[0]]):
        # XXX update this when q2q is updated to return a connector rather than
        # a Deferred.

        # XXX this isn't really dealing with the multiple-connectors use case
        # now.  sigma doesn't need this functionality, but we will need to
        # update this class to do it properly before using it to test other Q2Q
        # code.

        listener, description = self.listeners.get((toAddress, protocolName))
        if listener is None:
            print 'void listener', fromAddress, toAddress, self.listeners, self.listener
            reason = Failure(KeyError())
            protocolFactory.clientConnectionFailed(None, reason)
            return defer.fail(reason)
        else:
            def makeFakeClient(c):
                ft = FakeQ2QTransport(c, False, fromAddress, toAddress)
                return ft

            def makeFakeServer(s):
                ft = FakeQ2QTransport(s, True, toAddress, fromAddress)
                return ft

            client, server, pump = connectedServerAndClient(
                lambda: listener.buildProtocol(fromAddress),
                lambda: protocolFactory.buildProtocol(toAddress),
                makeFakeClient,
                makeFakeServer)
            self.pumps.append(pump)

            return defer.succeed(client)
dataset/ETHPy150Open twisted/vertex/vertex/test/helpers.py/FakeQ2QService.connectQ2Q/operator `and` -> `or`