Skip to content

Commit c9c6123

Browse files
committed
Handled comment for merge to master PR for apache 5.x
1 parent 2d727fa commit c9c6123

File tree

6 files changed

+20
-32
lines changed

6 files changed

+20
-32
lines changed

bom-internal/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@
9494
<artifactId>httpcore</artifactId>
9595
<version>${httpcomponents.httpcore.version}</version>
9696
</dependency>
97+
<dependency>
98+
<groupId>org.apache.httpcomponents.client5</groupId>
99+
<artifactId>httpclient5</artifactId>
100+
<version>${httpcomponents.client5.version}</version>
101+
</dependency>
102+
<dependency>
103+
<groupId>org.apache.httpcomponents.core5</groupId>
104+
<artifactId>httpcore5</artifactId>
105+
<version>${httpcomponents.core5.version}</version>
106+
</dependency>
97107
<dependency>
98108
<groupId>commons-codec</groupId>
99109
<artifactId>commons-codec</artifactId>

http-clients/apache5-client/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@
4343
<dependency>
4444
<groupId>org.apache.httpcomponents.client5</groupId>
4545
<artifactId>httpclient5</artifactId>
46-
<version>5.5</version>
4746
</dependency>
4847
<dependency>
4948
<groupId>org.apache.httpcomponents.core5</groupId>
5049
<artifactId>httpcore5</artifactId>
51-
<version>5.3.4</version>
5250
</dependency>
5351
<dependency>
5452
<groupId>software.amazon.awssdk</groupId>
@@ -110,11 +108,6 @@
110108
<artifactId>assertj-core</artifactId>
111109
<scope>test</scope>
112110
</dependency>
113-
<dependency>
114-
<groupId>org.hamcrest</groupId>
115-
<artifactId>hamcrest-all</artifactId>
116-
<scope>test</scope>
117-
</dependency>
118111
<dependency>
119112
<groupId>com.github.tomakehurst</groupId>
120113
<artifactId>wiremock-jre8</artifactId>

http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/Apache5HttpClient.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
@SdkPublicApi
114114
public final class Apache5HttpClient implements SdkHttpClient {
115115

116-
public static final String CLIENT_NAME = "Apache5Preview";
116+
private static final String CLIENT_NAME = "Apache5Preview";
117117

118118
private static final Logger log = Logger.loggerFor(Apache5HttpClient.class);
119119
private static final HostnameVerifier DEFAULT_HOSTNAME_VERIFIER = new DefaultHostnameVerifier();
@@ -733,14 +733,10 @@ public PoolingHttpClientConnectionManager create(Apache5HttpClient.DefaultBuilde
733733
// Skip TTL=0 to maintain backward compatibility (infinite in 4.x vs immediate expiration in 5.x)
734734
builder.setConnectionTimeToLive(TimeValue.of(connectionTtl.toMillis(), TimeUnit.MILLISECONDS));
735735
}
736-
PoolingHttpClientConnectionManager cm = builder.build();
737-
738-
739-
cm.setDefaultMaxPerRoute(standardOptions.get(SdkHttpConfigurationOption.MAX_CONNECTIONS));
740-
cm.setMaxTotal(standardOptions.get(SdkHttpConfigurationOption.MAX_CONNECTIONS));
741-
cm.setDefaultSocketConfig(buildSocketConfig(standardOptions));
742-
743-
return cm;
736+
builder.setMaxConnPerRoute(standardOptions.get(SdkHttpConfigurationOption.MAX_CONNECTIONS));
737+
builder.setMaxConnTotal(standardOptions.get(SdkHttpConfigurationOption.MAX_CONNECTIONS));
738+
builder.setDefaultSocketConfig(buildSocketConfig(standardOptions));
739+
return builder.build();
744740
}
745741

746742
private SSLConnectionSocketFactory getPreferredSocketFactory(Apache5HttpClient.DefaultBuilder configuration,

http-clients/apache5-client/src/main/resources/META-INF/native-image/software.amazon.awssdk/apache-client/reflect-config.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@
88
}
99
]
1010
},
11-
{
12-
"name": "org.apache.http.client.config.RequestConfig$Builder",
13-
"methods": [
14-
{
15-
"name": "setNormalizeUri"
16-
}
17-
]
18-
},
1911
{
2012
"name": "org.apache.commons.logging.LogFactory",
2113
"allDeclaredConstructors": true,

http-clients/apache5-client/src/test/java/software/amazon/awssdk/http/apache5/Apache5ClientTlsAuthTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
2121
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
2222
import static org.assertj.core.api.Assertions.assertThat;
23-
import static org.hamcrest.Matchers.anyOf;
24-
import static org.hamcrest.Matchers.instanceOf;
23+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
2524
import static software.amazon.awssdk.utils.JavaSystemSetting.SSL_KEY_STORE;
2625
import static software.amazon.awssdk.utils.JavaSystemSetting.SSL_KEY_STORE_PASSWORD;
2726
import static software.amazon.awssdk.utils.JavaSystemSetting.SSL_KEY_STORE_TYPE;
2827

2928
import com.github.tomakehurst.wiremock.WireMockServer;
3029
import java.io.IOException;
31-
import java.net.SocketException;
3230
import java.net.URI;
3331
import java.security.KeyManagementException;
3432
import java.security.NoSuchAlgorithmException;
@@ -37,8 +35,6 @@
3735
import javax.net.ssl.SSLException;
3836
import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
3937
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
40-
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
41-
import org.apache.hc.core5.http.NoHttpResponseException;
4238
import org.junit.After;
4339
import org.junit.AfterClass;
4440
import org.junit.Before;
@@ -126,11 +122,11 @@ public void canMakeHttpsRequestWhenKeyProviderConfigured() throws IOException {
126122

127123
@Test
128124
public void requestFailsWhenKeyProviderNotConfigured() throws IOException {
129-
thrown.expect(anyOf(instanceOf(NoHttpResponseException.class), instanceOf(SSLException.class), instanceOf(SocketException.class)));
130125
client = Apache5HttpClient.builder().tlsKeyManagersProvider(NoneTlsKeyManagersProvider.getInstance()).build();
131-
makeRequestWithHttpClient(client);
126+
assertThatThrownBy(() -> makeRequestWithHttpClient(client)).isInstanceOf(SSLException.class);
132127
}
133128

129+
134130
@Test
135131
public void authenticatesWithTlsProxy() throws IOException {
136132
ProxyConfiguration proxyConfig = ProxyConfiguration.builder()

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@
183183
<jre.version>1.8</jre.version>
184184
<httpcomponents.httpclient.version>4.5.13</httpcomponents.httpclient.version>
185185
<httpcomponents.httpcore.version>4.4.16</httpcomponents.httpcore.version>
186-
186+
<httpcomponents.client5.version>5.5</httpcomponents.client5.version>
187+
<httpcomponents.core5.version>5.3.4</httpcomponents.core5.version>
187188
<!-- Reactive Streams version -->
188189
<reactive-streams.version>1.0.4</reactive-streams.version>
189190

0 commit comments

Comments
 (0)