def testShutdownException(self):
        """
        If the other side has already closed its connection,
        loseWriteConnection should pass silently.
        """
        self.f.protocol.transport.loseConnection()
        self.client.transport.write(b"X")
        self.client.transport.loseWriteConnection()
        self.f.protocol.closedDeferred = d = defer.Deferred()
        self.client.closedDeferred = d2 = defer.Deferred()
        d.addCallback(lambda x:
                      self.assertTrue(self.f.protocol.closed))
        return defer.gatherResults([d, d2])

        If the other side has already closed its connection,
        loseWriteConnection should pass silently.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_tcp.py