Skip to content

Commit

Permalink
Fixed test that was relying on default configuration, rather than exp…
Browse files Browse the repository at this point in the history
…licit.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet committed Oct 6, 2024
1 parent e5a672c commit 53dff62
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ public void onClose(Session session, GoAwayFrame frame, Callback callback)
@Test
public void testServerSendsLargeHeader() throws Exception
{
int maxResponseHeadersSize = 8 * 1024;
CompletableFuture<Throwable> serverFailureFuture = new CompletableFuture<>();
CompletableFuture<String> serverCloseReasonFuture = new CompletableFuture<>();
start(new ServerSessionListener()
Expand All @@ -1076,9 +1077,9 @@ public void testServerSendsLargeHeader() throws Exception
public Stream.Listener onNewStream(Stream stream, HeadersFrame frame)
{
HTTP2Session session = (HTTP2Session)stream.getSession();
session.getGenerator().getHpackEncoder().setMaxHeaderListSize(1024 * 1024);
session.getGenerator().getHpackEncoder().setMaxHeaderListSize(2 * maxResponseHeadersSize);

String value = "x".repeat(8 * 1024);
String value = "x".repeat(maxResponseHeadersSize);
HttpFields fields = HttpFields.build().put("custom", value);
MetaData.Response response = new MetaData.Response(HttpStatus.OK_200, null, HttpVersion.HTTP_2, fields);
stream.headers(new HeadersFrame(stream.getId(), response, null, true));
Expand All @@ -1100,6 +1101,7 @@ public void onClose(Session session, GoAwayFrame frame, Callback callback)
}
});

http2Client.setMaxResponseHeadersSize(maxResponseHeadersSize);
CompletableFuture<Throwable> clientFailureFuture = new CompletableFuture<>();
CompletableFuture<String> clientCloseReasonFuture = new CompletableFuture<>();
Session.Listener listener = new Session.Listener()
Expand Down

0 comments on commit 53dff62

Please sign in to comment.