HttpClient 4.3.5 ConnectionRequestTimeOut vs ConnectTimeout for HttpConnectionParams.setConnectionTimeout in 4.0.1

In version 4.3 of Apache Http Client the configuration was refactored (again). the new way as the following code:

RequestConfig requestConfig =RequestConfig.custom()
.setConnectTimeout(connectTimeout)
.setConnectionRequestTimeout(connectionRequestTimeout)
.setSocketTimeout(socketTimeout).build();

connectTimeout is the timeout until a connection with the server is established. connectionRequestTimeout is used when requesting a connection from the connection manager.


Difference between the three timeouts in Apache HttpClient :

connectTimeout max time to establish a connection with remote host/server.

connectionRequestTimeout time to wait for getting a connection from the connection manager/pool. (HttpClient maintains a connection pool to manage the connections. Similar to database connection pool)

socketTimeout max time gap between two consecutive data packets while transferring data from server to client.