'Test that packets sent while compression and encryption are
enabled are sent correctly.  The packet type and data should be
compressed and then the whole packet should be encrypted.'

def test_sendPacketBoth(self):

    proto = MockTransportBase()
    proto.makeConnection(self.transport)
    self.finishKeyExchange(proto)
    proto.currentEncryptions = testCipher = MockCipher()
    proto.outgoingCompression = MockCompression()
    message = ord('A')
    payload = 'BC'
    self.transport.clear()
    proto.sendPacket(message, payload)
    self.assertTrue(testCipher.usedEncrypt)
    value = self.transport.value()
    self.assertEqual(value, '\x00\x00\x00\x0e DCTB CBAf\x99\x99\x99\x99\x99\x99\x99\x99\x99\x02')
