Try to stabilize httpConnectionsAreClosedAfterLongPollTimeout

Closes gh-26888
pull/27348/head
Andy Wilkinson 3 years ago
parent 7a14a53250
commit c89430e174

@ -22,11 +22,13 @@ import java.net.SocketTimeoutException;
import java.nio.ByteBuffer;
import java.nio.channels.ByteChannel;
import java.nio.channels.Channels;
import java.time.Duration;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ -236,13 +238,14 @@ class HttpTunnelServerTests {
this.server.setLongPollTimeout(100);
MockHttpConnection h1 = new MockHttpConnection();
this.server.handle(h1);
Awaitility.await().atMost(Duration.ofSeconds(30)).until(h1.getServletResponse()::getStatus,
(status) -> status == 204);
MockHttpConnection h2 = new MockHttpConnection();
this.server.handle(h2);
Thread.sleep(400);
Awaitility.await().atMost(Duration.ofSeconds(30)).until(h2.getServletResponse()::getStatus,
(status) -> status == 204);
this.serverChannel.disconnect();
this.server.getServerThread().join();
assertThat(h1.getServletResponse().getStatus()).isEqualTo(204);
assertThat(h2.getServletResponse().getStatus()).isEqualTo(204);
}
@Test

Loading…
Cancel
Save