I am migrating some projects from java 11 and Spring Boot 2.x to Java 17 and Spring Boot 3.0.0. I have the following code:
return org.apache.http.impl.client.HttpClients.custom()
.setKeepAliveStrategy(httpClient4connectionKeepAliveStrategy)
.setConnectionManager(httpClient4ConnectionManager(withCustomSslConfig))
.setDefaultRequestConfig(org.apache.http.client.config.RequestConfig.custom()
.setConnectionRequestTimeout(clientConnection.getConnectionRequestTimeout())
.setConnectTimeout(clientConnection.getConnectTimeout())
.setSocketTimeout(clientConnection.getReadTimeout())
.build());
but in the new http 5 RequestConfig.Builder there is no setSocketTimeout method. How to solve this issue?
Obviously with the new API the idea was to separate different kinds of configurations, because the connection timeout and the socket timeout are connection specific, and the connection request timeout is request specific. That is why I put the socket timeout and the connection timeout in a ConnectionConfig object and add it to the connectionManager.