def test_receiveDisconnect(self):
        """
        Test that disconnection messages are received correctly.  See
        test_sendDisconnect.
        """
        disconnected = [False]
        def stubLoseConnection():
            disconnected[0] = True
        self.transport.loseConnection = stubLoseConnection
        self.proto.dispatchMessage(transport.MSG_DISCONNECT,
                                   b'\x00\x00\x00\xff\x00\x00\x00\x04test')
        self.assertEqual(self.proto.errors, [(255, b'test')])
        self.assertTrue(disconnected[0])

        Test that disconnection messages are received correctly.  See
        test_sendDisconnect.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_transport.py