The ByteBufferInputStream implementation does not properly convert values returned by "ByteBuffer.get()" to integer values. The current implementation converts via numeric cast. The preserves the numeric value and the not bit pattern. Integer conversion should be preformed via a bitwise-and (ie ByteBuffer.read() & 0xFF).
This is causing problems with binary http response entities when using the Async features of the Jersey HTTP client. In some cases I am seeing bytes within the response body whose value is 0xFF to be silently dropped.