int read = Channels.readFromFileChannel(fileChannel, offsetToRead, copy);
assertThat(read, Matchers.equalTo(lengthToRead));
copy.flip();
BytesReference sourceRef = new BytesArray(randomBytes, offset + offsetToRead, lengthToRead);
BytesReference copyRef = new ByteBufferBytesReference(copy);
assertTrue("read bytes didn't match written bytes", sourceRef.equals(copyRef));
}