def clientDisconnected(result):
            """
            Verify that the underlying platform socket handle has been
            cleaned up.
            """
            client, server = result
            if not client.lostConnectionReason.check(error.ConnectionClosed):
                err(client.lostConnectionReason,
                    "Client lost connection for unexpected reason")
            if not server.lostConnectionReason.check(error.ConnectionClosed):
                err(server.lostConnectionReason,
                    "Server lost connection for unexpected reason")
            errorCodeMatcher = self.getHandleErrorCodeMatcher()
            exception = self.assertRaises(
                self.getHandleExceptionType(), client.handle.send, b'bytes')
            hamcrest.assert_that(
                exception.args[0],
                errorCodeMatcher,
            )

            Verify that the underlying platform socket handle has been
            cleaned up.
            
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_tcp.py