use of io.netty.buffer.ByteBuf in project netty by netty.
the class SpdyHeaderBlockRawDecoderTest method testMissingValue.
@Test
public void testMissingValue() throws Exception {
ByteBuf headerBlock = Unpooled.buffer(16);
headerBlock.writeInt(1);
headerBlock.writeInt(4);
headerBlock.writeBytes(nameBytes);
headerBlock.writeInt(5);
decoder.decode(ByteBufAllocator.DEFAULT, headerBlock, frame);
decoder.endHeaderBlock(frame);
assertFalse(headerBlock.isReadable());
assertTrue(frame.isInvalid());
assertEquals(0, frame.headers().names().size());
headerBlock.release();
}
use of io.netty.buffer.ByteBuf in project netty by netty.
the class SpdyHeaderBlockRawDecoderTest method testNegativeNameValuePairs.
@Test
public void testNegativeNameValuePairs() throws Exception {
ByteBuf headerBlock = Unpooled.buffer(4);
headerBlock.writeInt(-1);
decoder.decode(ByteBufAllocator.DEFAULT, headerBlock, frame);
assertFalse(headerBlock.isReadable());
assertTrue(frame.isInvalid());
assertEquals(0, frame.headers().names().size());
headerBlock.release();
}
use of io.netty.buffer.ByteBuf in project netty by netty.
the class SpdyHeaderBlockRawDecoderTest method testIllegalValueStartsWithNull.
@Test
public void testIllegalValueStartsWithNull() throws Exception {
ByteBuf headerBlock = Unpooled.buffer(22);
headerBlock.writeInt(1);
headerBlock.writeInt(4);
headerBlock.writeBytes(nameBytes);
headerBlock.writeInt(6);
headerBlock.writeByte(0);
headerBlock.writeBytes(valueBytes);
decoder.decode(ByteBufAllocator.DEFAULT, headerBlock, frame);
assertFalse(headerBlock.isReadable());
assertTrue(frame.isInvalid());
assertEquals(0, frame.headers().names().size());
headerBlock.release();
}
use of io.netty.buffer.ByteBuf in project netty by netty.
the class SpdyHeaderBlockRawDecoderTest method testIllegalValueEndsWithNull.
@Test
public void testIllegalValueEndsWithNull() throws Exception {
ByteBuf headerBlock = Unpooled.buffer(22);
headerBlock.writeInt(1);
headerBlock.writeInt(4);
headerBlock.writeBytes(nameBytes);
headerBlock.writeInt(6);
headerBlock.writeBytes(valueBytes);
headerBlock.writeByte(0);
decoder.decode(ByteBufAllocator.DEFAULT, headerBlock, frame);
assertFalse(headerBlock.isReadable());
assertTrue(frame.isInvalid());
assertEquals(0, frame.headers().names().size());
headerBlock.release();
}
use of io.netty.buffer.ByteBuf in project netty by netty.
the class SpdyHeaderBlockRawDecoderTest method testIllegalValueMultipleNulls.
@Test
public void testIllegalValueMultipleNulls() throws Exception {
ByteBuf headerBlock = Unpooled.buffer(28);
headerBlock.writeInt(1);
headerBlock.writeInt(4);
headerBlock.writeBytes(nameBytes);
headerBlock.writeInt(12);
headerBlock.writeBytes(valueBytes);
headerBlock.writeByte(0);
headerBlock.writeByte(0);
headerBlock.writeBytes(valueBytes);
decoder.decode(ByteBufAllocator.DEFAULT, headerBlock, frame);
decoder.endHeaderBlock(frame);
assertFalse(headerBlock.isReadable());
assertTrue(frame.isInvalid());
assertEquals(0, frame.headers().names().size());
headerBlock.release();
}
Aggregations