'Test that packets sent while encryption is enabled are sent
correctly.  The whole packet should be encrypted.'

def test_sendPacketEncrypted(self):

    proto = MockTransportBase()
    proto.makeConnection(self.transport)
    self.finishKeyExchange(proto)
    proto.currentEncryptions = testCipher = MockCipher()
    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\x08\x04ABC\x99\x99\x99\x99\x02')
