'When a connection is lost a message is logged containing an
address identifying the port and the fact that it was closed.'

def test_connectionLostLogMessage(self):

    loggedMessages = self.observe()
    reactor = self.buildReactor()
    p = self.getListeningPort(reactor, DatagramProtocol())
    expectedMessage = ('(UDP    Port    %s    Closed)' % (p.getHost().port,))
    def stopReactor(ignored):
        reactor.stop()
    def doStopListening():
        del loggedMessages[:]
        maybeDeferred(p.stopListening).addCallback(stopReactor)
    reactor.callWhenRunning(doStopListening)
    self.runReactor(reactor)
    self.assertEqual((expectedMessage,), loggedMessages[0]['message'])
