adyen-java-api-library icon indicating copy to clipboard operation
adyen-java-api-library copied to clipboard

Refactor Apache HttpClient 5.5 integration to remove deprecated API usage

Open Copilot opened this issue 2 months ago • 0 comments

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 SSLConnectionSocketFactory with DefaultClientTlsStrategy, changed connection manager from setSSLSocketFactory() to setTlsSocketStrategy()
  • Connect timeout: Moved from deprecated RequestConfig.Builder.setConnectTimeout() to ConnectionConfig.setConnectTimeout(Timeout) applied at connection manager level
  • Proxy configuration: Replaced RequestConfig.Builder.setProxy() with DefaultProxyRoutePlanner set via route planner. Now respects proxy type (HTTP/SOCKS) from Proxy object
  • Imports: Added ConnectionConfig, DefaultProxyRoutePlanner, DefaultClientTlsStrategy, Timeout; removed SSLConnectionSocketFactory

Tested scenarios

  • All existing unit tests pass (ClientTest, AdyenCustomRedirectStrategyTest, PaymentTest)
  • Compilation with -Xlint:deprecation produces zero warnings for AdyenHttpClient
  • 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 AdyenHttpClient class.

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.

Copilot avatar Dec 12 '25 13:12 Copilot