Skip to content

Commit e251891

Browse files
committed
Tolerate different connection failure exception thrown on Java 11+
See gh-4657
1 parent 29c6b9d commit e251891

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import org.apache.coyote.ProtocolHandler;
5959
import org.apache.coyote.http11.AbstractHttp11Protocol;
6060
import org.apache.http.HttpResponse;
61+
import org.apache.http.NoHttpResponseException;
6162
import org.apache.http.client.HttpClient;
6263
import org.apache.http.conn.HttpHostConnectException;
6364
import org.apache.http.impl.client.HttpClients;
@@ -616,8 +617,10 @@ void whenServerIsShuttingDownARequestOnAnIdleConnectionResultsInConnectionReset(
616617
Object response = request.get();
617618
assertThat(response).isInstanceOf(HttpResponse.class);
618619
Object idleConnectionRequestResult = idleConnectionRequest.get();
619-
assertThat(idleConnectionRequestResult).isInstanceOf(SocketException.class);
620-
assertThat((SocketException) idleConnectionRequestResult).hasMessage("Connection reset");
620+
assertThat(idleConnectionRequestResult).isInstanceOfAny(SocketException.class, NoHttpResponseException.class);
621+
if (idleConnectionRequestResult instanceof SocketException) {
622+
assertThat((SocketException) idleConnectionRequestResult).hasMessage("Connection reset");
623+
}
621624
this.webServer.stop();
622625
}
623626

0 commit comments

Comments
 (0)