use of software.amazon.awssdk.http.nio.netty.Http2Configuration in project aws-sdk-java-v2 by aws.
the class WindowSizeTest method expectCorrectWindowSizeValueTest.
private void expectCorrectWindowSizeValueTest(Integer builderSetterValue, int settingsFrameValue) throws InterruptedException {
ConcurrentLinkedQueue<Http2Frame> receivedFrames = new ConcurrentLinkedQueue<>();
server = new TestH2Server(() -> new StreamHandler(receivedFrames));
server.init();
netty = NettyNioAsyncHttpClient.builder().protocol(Protocol.HTTP2).http2Configuration(Http2Configuration.builder().initialWindowSize(builderSetterValue).build()).build();
AsyncExecuteRequest req = AsyncExecuteRequest.builder().requestContentPublisher(new EmptyPublisher()).request(SdkHttpFullRequest.builder().method(SdkHttpMethod.GET).protocol("http").host("localhost").port(server.port()).build()).responseHandler(new SdkAsyncHttpResponseHandler() {
@Override
public void onHeaders(SdkHttpResponse headers) {
}
@Override
public void onStream(Publisher<ByteBuffer> stream) {
}
@Override
public void onError(Throwable error) {
}
}).build();
netty.execute(req).join();
List<Http2Settings> receivedSettings = receivedFrames.stream().filter(f -> f instanceof Http2SettingsFrame).map(f -> (Http2SettingsFrame) f).map(Http2SettingsFrame::settings).collect(Collectors.toList());
assertThat(receivedSettings.size()).isGreaterThan(0);
for (Http2Settings s : receivedSettings) {
assertThat(s.initialWindowSize()).isEqualTo(settingsFrameValue);
}
}
Aggregations