Commit e2518917 authored by Andy Wilkinson's avatar Andy Wilkinson

Tolerate different connection failure exception thrown on Java 11+

See gh-4657
parent 29c6b9da
......@@ -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(idleConnectionRequestResult).isInstanceOfAny(SocketException.class, NoHttpResponseException.class);
if (idleConnectionRequestResult instanceof SocketException) {
assertThat((SocketException) idleConnectionRequestResult).hasMessage("Connection reset");
}
this.webServer.stop();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment