How to set ProxyAuthenticationStrategy in HttpClientBuilder?

614 Views Asked by At

I am updating the java version of our micro services from Java 11 to Java 17. In one of our micro services I have the following piece of code:

baseHttpClientBuilder.
.setProxyAuthenticationStrategy(INSTANCE)
...
...
.build()

where the HttpClientBuilder is org.apache.http.impl.client.HttpClientBuilder; and INSTANCE is

org.apache.http.impl.client.ProxyAuthenticationStrategy.INSTANCE

How should I replace this code, using the httpclient5 package, which is used in Spring Boot 3.x? There the HttpClientBuilder is org.apache.hc.client5.http.impl.classic.HttpClientBuilder

This builder has also

.setProxyAuthenticationStrategy(AuthenticationStrategy strategy)

method, but in the httpclient packages I do not see any ProxyAuthenticationStategy implementation classes, which I could use. ChatGPT said, that there is a class

org.apache.hc.client5.http.impl.classic.ProxyAuthenticationStrategy,

but I did not find any like this.

0

There are 0 best solutions below