def completeClientLostConnection(
            self, reason=failure.Failure(main.CONNECTION_DONE)):
        """
        Asserts that the client broker's transport was closed and then
        mimics the event loop by calling the broker's connectionLost
        callback with C{reason}, followed by C{self.clientFactory}'s
        C{clientConnectionLost}

        @param reason: (optional) the reason to pass to the client
            broker's connectionLost callback
        @type reason: L{Failure}
        """
        self.assertTrue(self.client.transport.closed)
        # simulate the reactor calling back the client's
        # connectionLost after the loseConnection implied by
        # clientFactory.disconnect
        self.client.connectionLost(reason)
        self.clientFactory.clientConnectionLost(self.connector, reason)

        Asserts that the client broker's transport was closed and then
        mimics the event loop by calling the broker's connectionLost
        callback with C{reason}, followed by C{self.clientFactory}'s
        C{clientConnectionLost}

        @param reason: (optional) the reason to pass to the client
            broker's connectionLost callback
        @type reason: L{Failure}
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/test/test_pb.py