'The server does not leak a reference when the client disconnects
suddenly, even if the cred logout function forms a reference cycle with
the perspective.'

def test_logoutLeak(self):

    self.mindRef = None
    def setMindRef(mind):
        self.mindRef = weakref.ref(mind)
    (clientBroker, serverBroker, pump) = connectedServerAndClient(test=self, realm=LeakyRealm(setMindRef))
    connectionBroken = []
    root = clientBroker.remoteForName('root')
    d = root.callRemote('login', 'guest')
    def cbResponse(x):
        (challenge, challenger) = x
        mind = SimpleRemote()
        return challenger.callRemote('respond', pb.respond(challenge, 'guest'), mind)
    d.addCallback(cbResponse)
    def connectionLost(_):
        pump.stop()
        connectionBroken.append(1)
        serverBroker.connectionLost(failure.Failure(RuntimeError('boom')))
    d.addCallback(connectionLost)
    pump.flush()
    self.assertEqual(connectionBroken, [1])
    gc.collect()
    self.assertIsNone(self.mindRef())
