Refactor Apache HttpClient 5.5 integration to remove deprecated API usage
Description
Apache HttpClient 5.5 deprecated several core APIs used in AdyenHttpClient. This refactoring migrates to the recommended replacements while maintaining identical functionality.
Changes:
-
SSL/TLS strategy: Replaced
SSLConnectionSocketFactorywithDefaultClientTlsStrategy, changed connection manager fromsetSSLSocketFactory()tosetTlsSocketStrategy() -
Connect timeout: Moved from deprecated
RequestConfig.Builder.setConnectTimeout()toConnectionConfig.setConnectTimeout(Timeout)applied at connection manager level -
Proxy configuration: Replaced
RequestConfig.Builder.setProxy()withDefaultProxyRoutePlannerset via route planner. Now respects proxy type (HTTP/SOCKS) fromProxyobject -
Imports: Added
ConnectionConfig,DefaultProxyRoutePlanner,DefaultClientTlsStrategy,Timeout; removedSSLConnectionSocketFactory
Tested scenarios
- All existing unit tests pass (ClientTest, AdyenCustomRedirectStrategyTest, PaymentTest)
- Compilation with
-Xlint:deprecationproduces zero warnings forAdyenHttpClient - SSL context, hostname verifier, proxy, and timeout configurations verified through existing test coverage
Fixed issue: #1601
Original prompt
This section details on the original issue you should resolve
<issue_title>Refactor integration of Apache HttpClient 5.5</issue_title> <issue_description>### Feature summary
Refactor usage of deprecated method and adopt best practices
Problem statement
In Adyen/adyen-java-api-library#1596 the Apache HttpClient dependency has been upgraded to v5.5. The new version deprecate several methods, requiring a refactoring of the
AdyenHttpClientclass.This shall be planned in major release
Proposed solution
Refactor the code that integrates Apache HttpClient 5.5 to adopt the best practices.
Alternatives considered
No response
Additional context
No response</issue_description>
<agent_instructions>Refactor to avoid using deprecated methods in the Apache HttpClient. </agent_instructions>
Comments on the Issue (you are @copilot in this section)
@gcatanese Hey @stijnn17, we are not planning to perform the refactoring now, but we plan the release of a new version (that works with Apache Http Client 5.5) on week 50 (from Dec 7th).The refactoring to avoid using deprecated methods is important, but it doesn't affect the library or your integration.
@gcatanese Hey @stijnn17, we have release a patch [v40.0.1](https://github.com/Adyen/adyen-java-api-library/releases/tag/v40.0.1). See also [here](https://github.com/Adyen/adyen-java-api-library/issues/1586#issuecomment-3607395368)
- Fixes Adyen/adyen-java-api-library#1597
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.