Skip to content

Commit 22b4d81

Browse files
authored
[Test] Use stream.next instead of setAutoRead in test (#115063)
For a more realistic simulation.
1 parent b4a5817 commit 22b4d81

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/transport-netty4/src/internalClusterTest/java/org/elasticsearch/http/netty4/Netty4IncrementalRequestHandlingIT.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,16 @@ public void testClientConnectionCloseMidStream() throws Exception {
175175
var handler = ctx.awaitRestChannelAccepted(opaqueId);
176176
assertBusy(() -> assertNotNull(handler.stream.buf()));
177177

178-
// enable auto-read to receive channel close event
179-
handler.stream.channel().config().setAutoRead(true);
180178
assertFalse(handler.streamClosed);
181179

182-
// terminate connection and wait resources are released
180+
// terminate client connection
183181
ctx.clientChannel.close();
182+
// read the first half of the request
183+
handler.stream.next();
184+
// attempt to read more data and it should notice channel being closed eventually
185+
handler.stream.next();
186+
187+
// wait for resources to be released
184188
assertBusy(() -> {
185189
assertNull(handler.stream.buf());
186190
assertTrue(handler.streamClosed);

0 commit comments

Comments
 (0)