'The L{IListeningPort} returned by L{IReactorTCP.listenTCP} can be
stopped with its C{stopListening} method.  After the L{Deferred} it
(optionally) returns has been called back, the port number can be bound
to a new server.'

def testStopListening(self):

    f = MyServerFactory()
    port = reactor.listenTCP(0, f, interface='127.0.0.1')
    n = port.getHost().port
    def cbStopListening(ignored):
        port = reactor.listenTCP(n, f, interface='127.0.0.1')
        return port.stopListening()
    d = defer.maybeDeferred(port.stopListening)
    d.addCallback(cbStopListening)
    return d
