Skip to content

Commit

Permalink
fix: use platform default TCP buffer sizes (#855)
Browse files Browse the repository at this point in the history
* remove obsolete and deprecated parent

* use platform default TCP buffer sizes
  • Loading branch information
elharo authored and chingor13 committed Oct 24, 2019
1 parent 57fd1d8 commit 238f4c5
Showing 1 changed file with 2 additions and 12 deletions.
Expand Up @@ -29,7 +29,6 @@
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.methods.HttpTrace;
import org.apache.http.config.SocketConfig;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
Expand Down Expand Up @@ -74,7 +73,7 @@ public ApacheHttpTransport() {
* Constructor that allows an alternative Apache HTTP client to be used.
*
* <p>
* Note that in the previous version, we overrode several settings, however, we are no longer able
* Note that in the previous version, we overrode several settings. However, we are no longer able
* to do so.
* </p>
*
Expand Down Expand Up @@ -102,12 +101,11 @@ public ApacheHttpTransport(HttpClient httpClient) {
* </p>
* <ul>
* <li>The client connection manager is set to {@link PoolingHttpClientConnectionManager}.</li>
* <li>The socket buffer size is set to 8192 using {@link SocketConfig}.</li>
* <li><The retry mechanism is turned off using
* {@link HttpClientBuilder#disableRedirectHandling}.</li>
* <li>The route planner uses {@link SystemDefaultRoutePlanner} with
* {@link ProxySelector#getDefault()}, which uses the proxy settings from <a
* href="http://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html">system
* href="https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html">system
* properties</a>.</li>
* </ul>
*
Expand All @@ -127,7 +125,6 @@ public static HttpClient newDefaultHttpClient() {
* </p>
* <ul>
* <li>The client connection manager is set to {@link PoolingHttpClientConnectionManager}.</li>
* <li>The socket buffer size is set to 8192 using {@link SocketConfig}.</li>
* <li><The retry mechanism is turned off using
* {@link HttpClientBuilder#disableRedirectHandling}.</li>
* <li>The route planner uses {@link SystemDefaultRoutePlanner} with
Expand All @@ -140,17 +137,10 @@ public static HttpClient newDefaultHttpClient() {
* @since 1.31
*/
public static HttpClientBuilder newDefaultHttpClientBuilder() {
// Set socket buffer sizes to 8192
SocketConfig socketConfig =
SocketConfig.custom()
.setRcvBufSize(8192)
.setSndBufSize(8192)
.build();

return HttpClientBuilder.create()
.useSystemProperties()
.setSSLSocketFactory(SSLConnectionSocketFactory.getSocketFactory())
.setDefaultSocketConfig(socketConfig)
.setMaxConnTotal(200)
.setMaxConnPerRoute(20)
.setConnectionTimeToLive(-1, TimeUnit.MILLISECONDS)
Expand Down

0 comments on commit 238f4c5

Please sign in to comment.