Skip to content

Commit 126b428

Browse files
committed
Changed name tlsSocketStrategy on builder
1 parent 4e60a0d commit 126b428

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ public interface Builder extends SdkHttpClient.Builder<Apache5HttpClient.Builder
454454
Builder dnsResolver(DnsResolver dnsResolver);
455455

456456
/**
457+
* @deprecated this has been replaced with {{@link #tlsSocketStrategy(TlsSocketStrategy)}}
457458
* Configuration that defines a custom Socket factory. If set to a null value, a default factory is used.
458459
* <p>
459460
* When set to a non-null value, the use of a custom factory implies the configuration options TRUST_ALL_CERTIFICATES,
@@ -463,7 +464,17 @@ public interface Builder extends SdkHttpClient.Builder<Apache5HttpClient.Builder
463464
Builder socketFactory(SSLConnectionSocketFactory socketFactory);
464465

465466

466-
Builder tlsStrategy(TlsSocketStrategy tlsStrategy);
467+
/**
468+
* Configure a custom TLS strategy for SSL/TLS connections.
469+
* This is the preferred method over the deprecated {@link #socketFactory(SSLConnectionSocketFactory)}.
470+
*
471+
* @param tlsSocketStrategy The TLS strategy to use for upgrading connections to TLS.
472+
* If null, default TLS configuration will be used.
473+
* @return This builder for method chaining
474+
475+
*/
476+
477+
Builder tlsSocketStrategy(TlsSocketStrategy tlsSocketStrategy);
467478

468479
/**
469480
* Configuration that defines an HTTP route planner that computes the route an HTTP request should take.
@@ -652,8 +663,8 @@ public Builder socketFactory(SSLConnectionSocketFactory socketFactory) {
652663
}
653664

654665
@Override
655-
public Builder tlsStrategy(TlsSocketStrategy tlsStrategy) {
656-
this.tlsStrategy = tlsStrategy;
666+
public Builder tlsSocketStrategy(TlsSocketStrategy tlsSocketStrategy) {
667+
this.tlsStrategy = tlsSocketStrategy;
657668
this.legacySocketFactory = null; // Clear any legacy factory
658669
return this;
659670
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import javax.net.ssl.KeyManager;
3636
import javax.net.ssl.SSLContext;
3737
import javax.net.ssl.SSLException;
38-
import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
3938
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
4039
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
4140
import org.apache.hc.client5.http.ssl.TlsSocketStrategy;
@@ -274,7 +273,7 @@ public void build_settingTlsStrategy_configuresClientWithGivenStrategy() throws
274273
SdkTlsSocketFactory socketFactorySpy = Mockito.spy(socketFactory);
275274

276275
client = Apache5HttpClient.builder()
277-
.tlsStrategy(socketFactorySpy) // Modern approach
276+
.tlsSocketStrategy(socketFactorySpy) // Modern approach
278277
.build();
279278
makeRequestWithHttpClient(client);
280279

0 commit comments

Comments
 (0)