'Set up a server and connect a client to it.  Return a Deferred which
only fires once this is done.'

def setUp(self):

    self.serverFactory = MyHCFactory()
    self.serverFactory.protocolConnectionMade = defer.Deferred()
    self.port = reactor.listenTCP(0, self.serverFactory, interface='127.0.0.1')
    self.addCleanup(self.port.stopListening)
    addr = self.port.getHost()
    creator = protocol.ClientCreator(reactor, MyHCProtocol)
    clientDeferred = creator.connectTCP(addr.host, addr.port)
    def setClient(clientProtocol):
        self.clientProtocol = clientProtocol
    clientDeferred.addCallback(setClient)
    return defer.gatherResults([self.serverFactory.protocolConnectionMade, clientDeferred])
