'Test one of the permutations of client/server host/peer.'

def _hostpeertest(self, get, testServer):

    class TestProtocol(Protocol, ):
        def makeConnection(self, transport):
            Protocol.makeConnection(self, transport)
            self.onConnection.callback(transport)
    if testServer:
        server = TestProtocol()
        d = server.onConnection = Deferred()
        client = Protocol()
    else:
        server = Protocol()
        client = TestProtocol()
        d = client.onConnection = Deferred()
    loopback.loopbackAsync(server, client)
    def connected(transport):
        host = getattr(transport, get)()
        self.assertTrue(IAddress.providedBy(host))
    return d.addCallback(connected)
