'Check that the repr string of the server transport get the good port
number if the server listens on 0.'

def test_serverRepr(self):

    server = MyServerFactory()
    serverConnMade = server.protocolConnectionMade = defer.Deferred()
    port = reactor.listenTCP(0, server)
    self.addCleanup(port.stopListening)
    client = MyClientFactory()
    clientConnMade = client.protocolConnectionMade = defer.Deferred()
    connector = reactor.connectTCP('127.0.0.1', port.getHost().port, client)
    self.addCleanup(connector.disconnect)
    def check(result):
        (serverProto, clientProto) = result
        portNumber = port.getHost().port
        self.assertEqual(repr(serverProto.transport), ('<AccumulatingProtocol    #0    on    %s>' % (portNumber,)))
        serverProto.transport.loseConnection()
        clientProto.transport.loseConnection()
    return defer.gatherResults([serverConnMade, clientConnMade]).addCallback(check)
