Fix for ByteBuffers bug.

Also modify the tests to expose the problem.

Also fix bad ByteBuffer handling in TReadableJSONProtocol.