use of org.junit.jupiter.api.function.Executable in project netty by netty.
the class DefaultHttp2FrameReaderTest method failedWhenHeaderFrameDependsOnItself.
@Test
public void failedWhenHeaderFrameDependsOnItself() throws Http2Exception {
final ByteBuf input = Unpooled.buffer();
try {
Http2Headers headers = new DefaultHttp2Headers().authority("foo").method("get").path("/").scheme("https");
writeHeaderFramePriorityPresent(input, 1, headers, new Http2Flags().endOfHeaders(true).endOfStream(true).priorityPresent(true), 1, 10);
assertThrows(Http2Exception.class, new Executable() {
@Override
public void execute() throws Throwable {
frameReader.readFrame(ctx, input, listener);
}
});
} finally {
input.release();
}
}
use of org.junit.jupiter.api.function.Executable in project netty by netty.
the class DefaultHttp2FrameReaderTest method failedWhenWindowUpdateFrameWithZeroDelta.
@Test
public void failedWhenWindowUpdateFrameWithZeroDelta() throws Http2Exception {
final ByteBuf input = Unpooled.buffer();
try {
writeFrameHeader(input, 4, WINDOW_UPDATE, new Http2Flags(), 0);
input.writeInt(0);
assertThrows(Http2Exception.class, new Executable() {
@Override
public void execute() throws Throwable {
frameReader.readFrame(ctx, input, listener);
}
});
} finally {
input.release();
}
}
use of org.junit.jupiter.api.function.Executable in project netty by netty.
the class DefaultHttp2FrameReaderTest method failedWhenSettingsFrameWithWrongPayloadLength.
@Test
public void failedWhenSettingsFrameWithWrongPayloadLength() throws Http2Exception {
final ByteBuf input = Unpooled.buffer();
try {
writeFrameHeader(input, 8, SETTINGS, new Http2Flags(), 0);
input.writeInt(SETTINGS_MAX_HEADER_LIST_SIZE);
input.writeInt(1024);
assertThrows(Http2Exception.class, new Executable() {
@Override
public void execute() throws Throwable {
frameReader.readFrame(ctx, input, listener);
}
});
} finally {
input.release();
}
}
use of org.junit.jupiter.api.function.Executable in project netty by netty.
the class DefaultHttp2HeadersDecoderTest method decodeLargerThanHeaderListSizeButLessThanGoAway.
@Test
public void decodeLargerThanHeaderListSizeButLessThanGoAway() throws Exception {
decoder.maxHeaderListSize(MIN_HEADER_LIST_SIZE, MAX_HEADER_LIST_SIZE);
final ByteBuf buf = encode(b(":method"), b("GET"));
final int streamId = 1;
Http2Exception.HeaderListSizeException e = assertThrows(Http2Exception.HeaderListSizeException.class, new Executable() {
@Override
public void execute() throws Throwable {
decoder.decodeHeaders(streamId, buf);
}
});
assertEquals(streamId, e.streamId());
buf.release();
}
use of org.junit.jupiter.api.function.Executable in project netty by netty.
the class DefaultHttp2HeadersDecoderTest method decodeLargerThanHeaderListSizeButLessThanGoAwayWithInitialDecoderSettings.
@Test
public void decodeLargerThanHeaderListSizeButLessThanGoAwayWithInitialDecoderSettings() throws Exception {
final ByteBuf buf = encode(b(":method"), b("GET"), b("test_header"), b(String.format("%09000d", 0).replace('0', 'A')));
final int streamId = 1;
try {
Http2Exception.HeaderListSizeException e = assertThrows(Http2Exception.HeaderListSizeException.class, new Executable() {
@Override
public void execute() throws Throwable {
decoder.decodeHeaders(streamId, buf);
}
});
assertEquals(streamId, e.streamId());
} finally {
buf.release();
}
}
Aggregations