Skip to content

Commit a2550f0

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

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
@@ -176,12 +176,16 @@ public void testClientConnectionCloseMidStream() throws Exception {
176176
var handler = ctx.awaitRestChannelAccepted(opaqueId);
177177
assertBusy(() -> assertNotNull(handler.stream.buf()));
178178

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

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

0 commit comments

Comments
 (0)