Tolerate different connection failure exception thrown on Java 11+

See gh-4657
pull/20495/head
Andy Wilkinson 5 years ago
parent 29c6b9da5c
commit e2518917f4

@ -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();
}

Loading…
Cancel
Save