Don't directly use ByteBuffer backing array.
Misc fixes.
Extend a few more test classes, factor some test code.
Correct off-by-one in assert.