mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Use a timeout when joining threads in HttpTunnelServerTests
See gh-29522
This commit is contained in:
parent
458f6721bb
commit
940d969c7c
@ -130,7 +130,7 @@ class HttpTunnelServerTests {
|
||||
this.servletRequest.setContent("hello".getBytes());
|
||||
this.server.handle(this.request, this.response);
|
||||
this.serverChannel.disconnect();
|
||||
this.server.getServerThread().join();
|
||||
this.server.getServerThread().join(2000);
|
||||
this.serverChannel.verifyReceived("hello");
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ class HttpTunnelServerTests {
|
||||
System.out.println("sending");
|
||||
this.serverChannel.send("hello");
|
||||
this.serverChannel.disconnect();
|
||||
this.server.getServerThread().join();
|
||||
this.server.getServerThread().join(2000);
|
||||
assertThat(this.servletResponse.getContentAsString()).isEqualTo("hello");
|
||||
this.serverChannel.verifyReceived("hello");
|
||||
}
|
||||
@ -153,7 +153,7 @@ class HttpTunnelServerTests {
|
||||
givenServerConnectionOpenWillAnswerWithServerChannel();
|
||||
this.server.handle(this.request, this.response);
|
||||
this.serverChannel.disconnect();
|
||||
this.server.getServerThread().join();
|
||||
this.server.getServerThread().join(2000);
|
||||
this.serverChannel.verifyReceived(NO_DATA);
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ class HttpTunnelServerTests {
|
||||
this.serverChannel.send("=3");
|
||||
h3.verifyReceived("=3", 3);
|
||||
this.serverChannel.disconnect();
|
||||
this.server.getServerThread().join();
|
||||
this.server.getServerThread().join(2000);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -185,7 +185,7 @@ class HttpTunnelServerTests {
|
||||
MockHttpConnection h1 = new MockHttpConnection("1", 1);
|
||||
this.server.handle(h1);
|
||||
this.serverChannel.disconnect();
|
||||
this.server.getServerThread().join();
|
||||
this.server.getServerThread().join(2000);
|
||||
assertThat(h1.getServletResponse().getStatus()).isEqualTo(410);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ class HttpTunnelServerTests {
|
||||
MockHttpConnection h2 = new MockHttpConnection("DISCONNECT", 1);
|
||||
h2.getServletRequest().addHeader("Content-Type", "application/x-disconnect");
|
||||
this.server.handle(h2);
|
||||
this.server.getServerThread().join();
|
||||
this.server.getServerThread().join(2000);
|
||||
assertThat(h1.getServletResponse().getStatus()).isEqualTo(410);
|
||||
assertThat(this.serverChannel.isOpen()).isFalse();
|
||||
}
|
||||
@ -214,7 +214,7 @@ class HttpTunnelServerTests {
|
||||
h1.waitForResponse();
|
||||
assertThat(h1.getServletResponse().getStatus()).isEqualTo(429);
|
||||
this.serverChannel.disconnect();
|
||||
this.server.getServerThread().join();
|
||||
this.server.getServerThread().join(2000);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -228,7 +228,7 @@ class HttpTunnelServerTests {
|
||||
this.server.handle(h2);
|
||||
this.serverChannel.verifyReceived("1+2+3");
|
||||
this.serverChannel.disconnect();
|
||||
this.server.getServerThread().join();
|
||||
this.server.getServerThread().join(2000);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -245,7 +245,7 @@ class HttpTunnelServerTests {
|
||||
Awaitility.await().atMost(Duration.ofSeconds(30)).until(h2.getServletResponse()::getStatus,
|
||||
(status) -> status == 204);
|
||||
this.serverChannel.disconnect();
|
||||
this.server.getServerThread().join();
|
||||
this.server.getServerThread().join(2000);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -256,7 +256,7 @@ class HttpTunnelServerTests {
|
||||
MockHttpConnection h1 = new MockHttpConnection();
|
||||
this.server.handle(h1);
|
||||
this.serverChannel.send("hello");
|
||||
this.server.getServerThread().join();
|
||||
this.server.getServerThread().join(2000);
|
||||
assertThat(this.serverChannel.isOpen()).isFalse();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user