Ok sorry, maybe something like:

BasicHttpClientConnectionManager cm = new BasicHttpClientConnectionManager();
cm.setConnectionConfig(ConnectionConfig.custom().setConnectTimeout(Timeout.ofMilliseconds(connectionTimeout)).build());
        
HttpClients.custom().setConnectionManager(cm) ??

Joan.


-----Original Message-----
From: joan.balagu...@grupoventus.com <joan.balagu...@grupoventus.com> 
Sent: Thursday, January 16, 2025 11:58 AM
To: 'HttpClient User Discussion' <httpclient-users@hc.apache.org>
Subject: RE: Connect timeout in 5.4.1

Perfect thanks, that helped.

But if instead of having a 'PoolingHttpClientConnectionmanager' I only have a 
simple CloseableHttpClient built with HttpClients.custom() ... How can I set 
the connect timeout? I can set the socket timeout by using the 
'setDefaultRequestConfig', but I'm not able to see a way to set the connect 
timeout.

Thanks,

Joan.

-----Original Message-----
From: Oleg Kalnichevski <ol...@apache.org>
Sent: Tuesday, January 14, 2025 8:59 PM
To: HttpClient User Discussion <httpclient-users@hc.apache.org>
Subject: Re: Connect timeout in 5.4.1

On Tue, 2025-01-14 at 10:57 +0100, joan.balagu...@grupoventus.com
wrote:
> Hi Oleg,
> 
> In previous versions of HttpClient, I was setting the connect timeout 
> on the RequestConfigBuilder.setConnectTimeout(). Now this method is 
> deprecated, and I'm trying to find where to set it .. no luck ... I 
> don't see a method to set it in SocketConfig, 
> PoolingHttpClientConnectionManagerBuilder, HttpClients.custom(), ...
> 
> What class contains now the connect timeout?
> 

ConnectionConfig

Hope this helps

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to