public void testTruncatedValues() {
for (int value : new int[] { 0, 1, 127, 128, 65536, 198649, Integer.MAX_VALUE }) {
IoBuffer buffer = IoBuffer.wrap(encoder.encode(value));
for (int i = 0; i < buffer.remaining(); i++) {
IoBuffer partialBuffer = buffer.slice();
partialBuffer.limit(partialBuffer.position() + i);
try {
assertNull(decoder.decode(partialBuffer));
} catch (ProtocolDecoderException e) {