From d7a3be1cac7f275ffb0ba79aef97add089c16c4c Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Fri, 18 Oct 2024 15:41:21 +1100 Subject: [PATCH] [Test] Use stream.next instead of setAutoRead in test For a more realistic simulation. --- .../http/netty4/Netty4IncrementalRequestHandlingIT.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/transport-netty4/src/internalClusterTest/java/org/elasticsearch/http/netty4/Netty4IncrementalRequestHandlingIT.java b/modules/transport-netty4/src/internalClusterTest/java/org/elasticsearch/http/netty4/Netty4IncrementalRequestHandlingIT.java index 26d31b941f356..48cda5f88e98e 100644 --- a/modules/transport-netty4/src/internalClusterTest/java/org/elasticsearch/http/netty4/Netty4IncrementalRequestHandlingIT.java +++ b/modules/transport-netty4/src/internalClusterTest/java/org/elasticsearch/http/netty4/Netty4IncrementalRequestHandlingIT.java @@ -175,10 +175,11 @@ public void testClientConnectionCloseMidStream() throws Exception { var handler = ctx.awaitRestChannelAccepted(opaqueId); assertBusy(() -> assertNotNull(handler.stream.buf())); - // enable auto-read to receive channel close event - handler.stream.channel().config().setAutoRead(true); assertFalse(handler.streamClosed); + handler.stream.next(); // read the first half of the request + handler.stream.next(); // attempt to read more data and it should notice channel being closed eventually + // terminate connection and wait resources are released ctx.clientChannel.close(); assertBusy(() -> {