ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
erat.close();
ByteArrayRandomAccessBuffer barat2 = new ByteArrayRandomAccessBuffer(bytes);
byte[] magic = ByteBuffer.allocate(8).putLong(falseMagic).array();
barat2.pwrite(types[0].headerLen-8, magic, 0, 8);
thrown.expect(IOException.class);
thrown.expectMessage("This is not an EncryptedRandomAccessBuffer!");
EncryptedRandomAccessBuffer erat2 = new EncryptedRandomAccessBuffer(types[0], barat2, secret, false);
}