'Test that encrypted packets are retrieved correctly.
See test_sendPacketEncrypted.'

def test_getPacketEncrypted(self):

    proto = MockTransportBase()
    proto.sendKexInit = (lambda : None)
    proto.makeConnection(self.transport)
    self.transport.clear()
    proto.currentEncryptions = testCipher = MockCipher()
    proto.sendPacket(ord('A'), 'BCD')
    value = self.transport.value()
    proto.buf = value[:MockCipher.decBlockSize]
    self.assertIsNone(proto.getPacket())
    self.assertTrue(testCipher.usedDecrypt)
    self.assertEqual(proto.first, '\x00\x00\x00\x0e DCTB A')
    proto.buf += value[MockCipher.decBlockSize:]
    self.assertEqual(proto.getPacket(), 'ABCD')
    self.assertEqual(proto.buf, '')
