def test_sendGlobalRequest(self):
        """
        Test that global request messages are sent in the right format.
        """
        d = self.conn.sendGlobalRequest(b'wantReply', b'data', True)
        # must be added to prevent errbacking during teardown
        d.addErrback(lambda failure: None)
        self.conn.sendGlobalRequest(b'noReply', b'', False)
        self.assertEqual(self.transport.packets,
                [(connection.MSG_GLOBAL_REQUEST, common.NS(b'wantReply') +
                    b'\xffdata'),
                 (connection.MSG_GLOBAL_REQUEST, common.NS(b'noReply') +
                     b'\x00')])
        self.assertEqual(self.conn.deferreds, {'global':[d]})

        Test that global request messages are sent in the right format.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_connection.py