Skip to content

Commit aa489a5

Browse files
committed
Clean up unused APIs and add test to make sure it can be handled with alternatives
1 parent a959581 commit aa489a5

File tree

11 files changed

+394
-240
lines changed

11 files changed

+394
-240
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
package software.amazon.awssdk.http.apache;
16+
17+
import java.net.InetAddress;
18+
import java.time.Duration;
19+
import org.junit.jupiter.api.DisplayName;
20+
import software.amazon.awssdk.http.SdkHttpClient;
21+
import software.amazon.awssdk.http.SdkHttpClientLocalAddressFunctionalTestSuite;
22+
23+
@DisplayName("Apache HTTP Client - Local Address Functional Tests")
24+
class ApacheHttpClientLocalAddressFunctionalTest extends SdkHttpClientLocalAddressFunctionalTestSuite {
25+
26+
@Override
27+
protected SdkHttpClient createHttpClient(InetAddress localAddress, Duration connectionTimeout) {
28+
return ApacheHttpClient.builder()
29+
.localAddress(localAddress)
30+
.connectionTimeout(connectionTimeout)
31+
.build();
32+
}
33+
}

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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import java.io.ByteArrayInputStream;
2727
import java.io.IOException;
28-
import java.net.InetAddress;
2928
import java.security.KeyManagementException;
3029
import java.security.NoSuchAlgorithmException;
3130
import java.security.cert.CertificateException;
@@ -338,7 +337,6 @@ private Apache5HttpRequestConfig createRequestConfig(DefaultBuilder builder,
338337
.connectionAcquireTimeout(
339338
resolvedOptions.get(SdkHttpConfigurationOption.CONNECTION_ACQUIRE_TIMEOUT))
340339
.proxyConfiguration(builder.proxyConfiguration)
341-
.localAddress(Optional.ofNullable(builder.localAddress).orElse(null))
342340
.expectContinueEnabled(Optional.ofNullable(builder.expectContinueEnabled)
343341
.orElse(DefaultConfiguration.EXPECT_CONTINUE_ENABLED))
344342
.build();
@@ -406,11 +404,6 @@ public interface Builder extends SdkHttpClient.Builder<Apache5HttpClient.Builder
406404
*/
407405
Builder proxyConfiguration(ProxyConfiguration proxyConfiguration);
408406

409-
/**
410-
* Configure the local address that the HTTP client should use for communication.
411-
*/
412-
Builder localAddress(InetAddress localAddress);
413-
414407
/**
415408
* Configure whether the client should send an HTTP expect-continue handshake before each request.
416409
*/
@@ -498,7 +491,6 @@ private static final class DefaultBuilder implements Builder {
498491
private final AttributeMap.Builder standardOptions = AttributeMap.builder();
499492
private Registry<AuthSchemeFactory> authSchemeRegistry;
500493
private ProxyConfiguration proxyConfiguration = ProxyConfiguration.builder().build();
501-
private InetAddress localAddress;
502494
private Boolean expectContinueEnabled;
503495
private HttpRoutePlanner httpRoutePlanner;
504496
private CredentialsProvider credentialsProvider;
@@ -564,16 +556,6 @@ public void setProxyConfiguration(ProxyConfiguration proxyConfiguration) {
564556
proxyConfiguration(proxyConfiguration);
565557
}
566558

567-
@Override
568-
public Builder localAddress(InetAddress localAddress) {
569-
this.localAddress = localAddress;
570-
return this;
571-
}
572-
573-
public void setLocalAddress(InetAddress localAddress) {
574-
localAddress(localAddress);
575-
}
576-
577559
@Override
578560
public Builder expectContinueEnabled(Boolean expectContinueEnabled) {
579561
this.expectContinueEnabled = expectContinueEnabled;

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
package software.amazon.awssdk.http.apache5.internal;
1717

18-
import java.net.InetAddress;
1918
import java.time.Duration;
2019
import software.amazon.awssdk.annotations.SdkInternalApi;
2120
import software.amazon.awssdk.http.apache5.ProxyConfiguration;
@@ -30,15 +29,13 @@ public final class Apache5HttpRequestConfig {
3029
private final Duration socketTimeout;
3130
private final Duration connectionTimeout;
3231
private final Duration connectionAcquireTimeout;
33-
private final InetAddress localAddress;
3432
private final boolean expectContinueEnabled;
3533
private final ProxyConfiguration proxyConfiguration;
3634

3735
private Apache5HttpRequestConfig(Builder builder) {
3836
this.socketTimeout = builder.socketTimeout;
3937
this.connectionTimeout = builder.connectionTimeout;
4038
this.connectionAcquireTimeout = builder.connectionAcquireTimeout;
41-
this.localAddress = builder.localAddress;
4239
this.expectContinueEnabled = builder.expectContinueEnabled;
4340
this.proxyConfiguration = builder.proxyConfiguration;
4441
}
@@ -55,10 +52,6 @@ public Duration connectionAcquireTimeout() {
5552
return connectionAcquireTimeout;
5653
}
5754

58-
public InetAddress localAddress() {
59-
return localAddress;
60-
}
61-
6255
public boolean expectContinueEnabled() {
6356
return expectContinueEnabled;
6457
}
@@ -82,7 +75,6 @@ public static final class Builder {
8275
private Duration socketTimeout;
8376
private Duration connectionTimeout;
8477
private Duration connectionAcquireTimeout;
85-
private InetAddress localAddress;
8678
private boolean expectContinueEnabled;
8779
private ProxyConfiguration proxyConfiguration;
8880

@@ -104,11 +96,6 @@ public Builder connectionAcquireTimeout(Duration connectionAcquireTimeout) {
10496
return this;
10597
}
10698

107-
public Builder localAddress(InetAddress localAddress) {
108-
this.localAddress = localAddress;
109-
return this;
110-
}
111-
11299
public Builder expectContinueEnabled(boolean expectContinueEnabled) {
113100
this.expectContinueEnabled = expectContinueEnabled;
114101
return this;

http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/internal/conn/SdkTlsSocketFactory.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727
import org.apache.hc.core5.http.protocol.HttpContext;
2828
import org.apache.hc.core5.util.TimeValue;
2929
import software.amazon.awssdk.annotations.SdkInternalApi;
30-
import software.amazon.awssdk.http.apache5.internal.net.InputShutdownCheckingSslSocket;
3130
import software.amazon.awssdk.http.apache5.internal.net.SdkSocket;
32-
import software.amazon.awssdk.http.apache5.internal.net.SdkSslSocket;
3331
import software.amazon.awssdk.utils.Logger;
3432

3533
@SdkInternalApi
@@ -62,9 +60,6 @@ public Socket connectSocket(TimeValue connectTimeout,
6260
log.trace(() -> String.format("Connecting to %s:%s", remoteAddress.getAddress(), remoteAddress.getPort()));
6361

6462
Socket connectSocket = super.connectSocket(connectTimeout, socket, host, remoteAddress, localAddress, context);
65-
if (connectSocket instanceof SSLSocket) {
66-
return new InputShutdownCheckingSslSocket(new SdkSslSocket((SSLSocket) connectSocket));
67-
}
6863
return new SdkSocket(connectSocket);
6964
}
7065
}

http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/internal/impl/Apache5HttpRequestFactory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ private void addRequestConfig(HttpUriRequestBase base,
9898
.setConnectionRequestTimeout(connectAcquireTimeout, TimeUnit.MILLISECONDS)
9999
.setConnectTimeout(connectTimeout, TimeUnit.MILLISECONDS)
100100
.setResponseTimeout(saturatedCast(requestConfig.socketTimeout().toMillis()), TimeUnit.MILLISECONDS);
101-
// TODO as part of removed API : .setLocalAddress(requestConfig.localAddress());
102101

103102
/*
104103
* Enable 100-continue support for PUT operations, since this is

http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/internal/net/InputShutdownCheckingSslSocket.java

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)