@Test
public void testSuccesfulRoundTripReadHeader() throws IOException, GeneralSecurityException{
for(EncryptedRandomAccessBufferType type: types){
byte[] bytes = new byte[100];
ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(type, barat, secret, true);
erat.pwrite(0, message, 0, message.length);
erat.close();
ByteArrayRandomAccessBuffer barat2 = new ByteArrayRandomAccessBuffer(bytes);
EncryptedRandomAccessBuffer erat2 = new EncryptedRandomAccessBuffer(type, barat2, secret, false);
byte[] result = new byte[message.length];
erat2.pread(0, result, 0, result.length);
erat2.close();
assertArrayEquals(message, result);