Removes test duplication by generalizing testRoundTrip to work on both
byte[] and ByteBuffers.