-
Notifications
You must be signed in to change notification settings - Fork 932
Replace deprecated SSLConnectionSocketFactory with recommended API #6281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace deprecated SSLConnectionSocketFactory with recommended API #6281
Conversation
724e1b2
to
034f7b6
Compare
|
@@ -452,12 +454,27 @@ public interface Builder extends SdkHttpClient.Builder<Apache5HttpClient.Builder | |||
Builder dnsResolver(DnsResolver dnsResolver); | |||
|
|||
/** | |||
* @deprecated this has been replaced with {{@link #tlsSocketStrategy(TlsSocketStrategy)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we explain that this is here to ease migration from 4.5.x?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -252,4 +258,76 @@ private HttpExecuteResponse makeRequestWithHttpClient(SdkHttpClient httpClient) | |||
return httpClient.prepareRequest(request).call(); | |||
} | |||
|
|||
@Test | |||
public void tls_strategy_configuration() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: can we fix the test names so they match our normal conventions? i.e. methodToTest_when_expectedBehavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
.socketFactory(legacyFactorySpy) | ||
.tlsSocketStrategy(tlsStrategySpy) // This should override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just disallow setting both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
2bcd1e2
to
dcaaaf6
Compare
This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one. |
Motivation and Context
Apache HttpClient 5.x deprecated
ConnectionSocketFactory
in favor of the newTlsSocketStrategy
interface. This change updates the AWS SDK's Apache5 HTTP client to fully adopt the modern TLS configuration approach, completing the migration by removing the deprecated API entirely.Historical Context: Earlier versions of this implementation incorrectly used
SSLConnectionSocketFactory
instead of the more generalConnectionSocketFactory
interface. The correct API should have beenConnectionSocketFactory
, which was consistent with the SDK's Apache4 client implementation. However, Apache HttpClient 5.x has since deprecatedConnectionSocketFactory
entirely as part of a broader architectural redesign to better separate concerns between socket creation and TLS upgrade operations.The new
TlsSocketStrategy
interface provides a cleaner abstraction specifically for TLS upgrade operations, moving away from the socket factory pattern that mixed plain socket creation with TLS layering concerns.Modifications
Added
tlsSocketStrategy()
method inApache5HttpClient.Builder
to support the modern TLS configuration approachModified
SdkTlsSocketFactory
now extendsDefaultClientTlsStrategy
instead ofSSLConnectionSocketFactory
setTlsSocketStrategy()
instead of deprecatedsetSSLSocketFactory()
initializeSocket()
instead ofprepareSocket()
upgrade()
for TLS socket upgrades instead ofconnectSocket()
Removed
socketFactory()
method - completely removed to eliminate legacy API surfaceDelegateSocket
,SdkSocket
) - replaced with SSL-specificSdkSslSocket
Breaking Changes
socketFactory()
method removed: Users must migrate totlsSocketStrategy()
TlsSocketStrategy
is supportedMigration Path
Users must migrate from the deprecated approach to the modern API:
Before (Deprecated API):
After (Modern API):
Testing
License
License