mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-05 16:59:28 +00:00
Tolerate different connection failure exception thrown on Java 11+
See gh-4657
This commit is contained in:
+5
-2
@@ -58,6 +58,7 @@ import org.apache.catalina.valves.RemoteIpValve;
|
||||
import org.apache.coyote.ProtocolHandler;
|
||||
import org.apache.coyote.http11.AbstractHttp11Protocol;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NoHttpResponseException;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.conn.HttpHostConnectException;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
@@ -616,8 +617,10 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory
|
||||
Object response = request.get();
|
||||
assertThat(response).isInstanceOf(HttpResponse.class);
|
||||
Object idleConnectionRequestResult = idleConnectionRequest.get();
|
||||
assertThat(idleConnectionRequestResult).isInstanceOf(SocketException.class);
|
||||
assertThat((SocketException) idleConnectionRequestResult).hasMessage("Connection reset");
|
||||
assertThat(idleConnectionRequestResult).isInstanceOfAny(SocketException.class, NoHttpResponseException.class);
|
||||
if (idleConnectionRequestResult instanceof SocketException) {
|
||||
assertThat((SocketException) idleConnectionRequestResult).hasMessage("Connection reset");
|
||||
}
|
||||
this.webServer.stop();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user