diff --git a/bom-internal/pom.xml b/bom-internal/pom.xml index 3b079b684c3c..f8e88ee88c14 100644 --- a/bom-internal/pom.xml +++ b/bom-internal/pom.xml @@ -94,6 +94,16 @@ httpcore ${httpcomponents.httpcore.version} + + org.apache.httpcomponents.client5 + httpclient5 + ${httpcomponents.client5.version} + + + org.apache.httpcomponents.core5 + httpcore5 + ${httpcomponents.core5.version} + commons-codec commons-codec diff --git a/http-clients/apache5-client/pom.xml b/http-clients/apache5-client/pom.xml index c2426709da7b..46bae8e51051 100644 --- a/http-clients/apache5-client/pom.xml +++ b/http-clients/apache5-client/pom.xml @@ -43,12 +43,10 @@ org.apache.httpcomponents.client5 httpclient5 - 5.5 org.apache.httpcomponents.core5 httpcore5 - 5.3.4 software.amazon.awssdk @@ -110,11 +108,6 @@ assertj-core test - - org.hamcrest - hamcrest-all - test - com.github.tomakehurst wiremock-jre8 diff --git a/http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/Apache5HttpClient.java b/http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/Apache5HttpClient.java index ea7e64d8b15d..135b76e05a0d 100644 --- a/http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/Apache5HttpClient.java +++ b/http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/Apache5HttpClient.java @@ -113,7 +113,7 @@ @SdkPublicApi public final class Apache5HttpClient implements SdkHttpClient { - public static final String CLIENT_NAME = "Apache5Preview"; + private static final String CLIENT_NAME = "Apache5Preview"; private static final Logger log = Logger.loggerFor(Apache5HttpClient.class); private static final HostnameVerifier DEFAULT_HOSTNAME_VERIFIER = new DefaultHostnameVerifier(); @@ -733,14 +733,10 @@ public PoolingHttpClientConnectionManager create(Apache5HttpClient.DefaultBuilde // Skip TTL=0 to maintain backward compatibility (infinite in 4.x vs immediate expiration in 5.x) builder.setConnectionTimeToLive(TimeValue.of(connectionTtl.toMillis(), TimeUnit.MILLISECONDS)); } - PoolingHttpClientConnectionManager cm = builder.build(); - - - cm.setDefaultMaxPerRoute(standardOptions.get(SdkHttpConfigurationOption.MAX_CONNECTIONS)); - cm.setMaxTotal(standardOptions.get(SdkHttpConfigurationOption.MAX_CONNECTIONS)); - cm.setDefaultSocketConfig(buildSocketConfig(standardOptions)); - - return cm; + builder.setMaxConnPerRoute(standardOptions.get(SdkHttpConfigurationOption.MAX_CONNECTIONS)); + builder.setMaxConnTotal(standardOptions.get(SdkHttpConfigurationOption.MAX_CONNECTIONS)); + builder.setDefaultSocketConfig(buildSocketConfig(standardOptions)); + return builder.build(); } private SSLConnectionSocketFactory getPreferredSocketFactory(Apache5HttpClient.DefaultBuilder configuration, diff --git a/http-clients/apache5-client/src/main/resources/META-INF/native-image/software.amazon.awssdk/apache-client/reflect-config.json b/http-clients/apache5-client/src/main/resources/META-INF/native-image/software.amazon.awssdk/apache-client/reflect-config.json index ce80a77b59d4..cae8832dd42d 100644 --- a/http-clients/apache5-client/src/main/resources/META-INF/native-image/software.amazon.awssdk/apache-client/reflect-config.json +++ b/http-clients/apache5-client/src/main/resources/META-INF/native-image/software.amazon.awssdk/apache-client/reflect-config.json @@ -8,14 +8,6 @@ } ] }, - { - "name": "org.apache.http.client.config.RequestConfig$Builder", - "methods": [ - { - "name": "setNormalizeUri" - } - ] - }, { "name": "org.apache.commons.logging.LogFactory", "allDeclaredConstructors": true, diff --git a/http-clients/apache5-client/src/test/java/software/amazon/awssdk/http/apache5/Apache5ClientTlsAuthTest.java b/http-clients/apache5-client/src/test/java/software/amazon/awssdk/http/apache5/Apache5ClientTlsAuthTest.java index 8d3165be6ebd..45e4b44a6d59 100644 --- a/http-clients/apache5-client/src/test/java/software/amazon/awssdk/http/apache5/Apache5ClientTlsAuthTest.java +++ b/http-clients/apache5-client/src/test/java/software/amazon/awssdk/http/apache5/Apache5ClientTlsAuthTest.java @@ -20,8 +20,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.Matchers.anyOf; -import static org.hamcrest.Matchers.instanceOf; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static software.amazon.awssdk.utils.JavaSystemSetting.SSL_KEY_STORE; import static software.amazon.awssdk.utils.JavaSystemSetting.SSL_KEY_STORE_PASSWORD; import static software.amazon.awssdk.utils.JavaSystemSetting.SSL_KEY_STORE_TYPE; @@ -37,8 +36,6 @@ import javax.net.ssl.SSLException; import org.apache.hc.client5.http.socket.ConnectionSocketFactory; import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; -import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; -import org.apache.hc.core5.http.NoHttpResponseException; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -126,9 +123,8 @@ public void canMakeHttpsRequestWhenKeyProviderConfigured() throws IOException { @Test public void requestFailsWhenKeyProviderNotConfigured() throws IOException { - thrown.expect(anyOf(instanceOf(NoHttpResponseException.class), instanceOf(SSLException.class), instanceOf(SocketException.class))); client = Apache5HttpClient.builder().tlsKeyManagersProvider(NoneTlsKeyManagersProvider.getInstance()).build(); - makeRequestWithHttpClient(client); + assertThatThrownBy(() -> makeRequestWithHttpClient(client)).isInstanceOfAny(SSLException.class, SocketException.class); } @Test diff --git a/pom.xml b/pom.xml index 40b7605f53a2..5dc9ded7fa62 100644 --- a/pom.xml +++ b/pom.xml @@ -183,7 +183,8 @@ 1.8 4.5.13 4.4.16 - + 5.5 + 5.3.4 1.0.4