You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2018/08/21 15:01:17 UTC
[06/32] httpcomponents-core git commit: Moved class (no functional
changes; some tweaks to the example classes)
Moved class (no functional changes; some tweaks to the example classes)
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/9c0b2811
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/9c0b2811
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/9c0b2811
Branch: refs/heads/api_javadocs
Commit: 9c0b2811fc5aea61b74b51bef4e73a90560386ea
Parents: 2a14ba3
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Aug 6 13:58:53 2018 +0200
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Aug 6 13:58:53 2018 +0200
----------------------------------------------------------------------
.../testing/classic/ClassicTestClient.java | 2 +-
.../testing/classic/ClassicTestServer.java | 2 +-
.../framework/ClassicTestClientAdapter.java | 2 +-
.../testing/framework/TestingFramework.java | 2 +-
.../classic/ClassicAuthenticationTest.java | 2 +-
.../testing/classic/ClassicIntegrationTest.java | 2 +-
.../classic/ClassicServerAndRequesterTest.java | 2 +-
.../TestClassicTestClientTestingAdapter.java | 2 +-
.../http/examples/ClassicFileServerExample.java | 2 +-
.../examples/ClassicGetExecutionExample.java | 9 +-
.../examples/ClassicPostExecutionExample.java | 9 +-
...ClassicPostWithTrailersExecutionExample.java | 12 +-
.../examples/ClassicServerFilterExample.java | 2 +-
.../hc/core5/http/config/SocketConfig.java | 312 -------------------
.../http/impl/bootstrap/HttpRequester.java | 2 +-
.../core5/http/impl/bootstrap/HttpServer.java | 2 +-
.../http/impl/bootstrap/RequestListener.java | 2 +-
.../http/impl/bootstrap/RequesterBootstrap.java | 2 +-
.../http/impl/bootstrap/ServerBootstrap.java | 2 +-
.../apache/hc/core5/http/io/SocketConfig.java | 312 +++++++++++++++++++
20 files changed, 341 insertions(+), 343 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java
index 6537035..4260f1b 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java
@@ -38,7 +38,7 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
import org.apache.hc.core5.http.impl.HttpProcessors;
import org.apache.hc.core5.http.impl.DefaultAddressResolver;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestServer.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestServer.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestServer.java
index 75398a6..16a8a41 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestServer.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestServer.java
@@ -38,7 +38,7 @@ import org.apache.hc.core5.function.Decorator;
import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
import org.apache.hc.core5.http.impl.HttpProcessors;
import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
index 660d46c..d416e4b 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
@@ -39,7 +39,7 @@ import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.io.entity.StringEntity;
import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
index 36761d3..4cb64cf 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
@@ -50,7 +50,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.hc.core5.http.HttpVersion;
import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
import org.apache.hc.core5.io.CloseMode;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java
index ef652e5..c14bae1 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java
@@ -42,7 +42,7 @@ import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.HttpVersion;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.bootstrap.HttpRequester;
import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
import org.apache.hc.core5.http.impl.bootstrap.RequesterBootstrap;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicIntegrationTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicIntegrationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicIntegrationTest.java
index 292af56..dd70af6 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicIntegrationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicIntegrationTest.java
@@ -53,7 +53,7 @@ import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpRequestInterceptor;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.HttpVersion;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.io.HttpRequestHandler;
import org.apache.hc.core5.http.io.HttpServerRequestHandler;
import org.apache.hc.core5.http.io.entity.AbstractHttpEntity;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java
index 0a8249d..b6b08dd 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java
@@ -37,7 +37,7 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.bootstrap.HttpRequester;
import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
import org.apache.hc.core5.http.impl.bootstrap.RequesterBootstrap;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
index 2df7f0c..00c5f40 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
@@ -42,7 +42,7 @@ import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.testing.classic.ClassicTestServer;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java
index 4b18a73..f0f254e 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java
@@ -49,7 +49,7 @@ import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.MethodNotSupportedException;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
import org.apache.hc.core5.http.io.HttpRequestHandler;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java
index 18da4dc..0fd5f0d 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java
@@ -35,7 +35,7 @@ import org.apache.hc.core5.http.HttpConnection;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.Http1StreamListener;
import org.apache.hc.core5.http.impl.bootstrap.HttpRequester;
import org.apache.hc.core5.http.impl.bootstrap.RequesterBootstrap;
@@ -76,16 +76,15 @@ public class ClassicGetExecutionExample {
}
})
+ .setSocketConfig(SocketConfig.custom()
+ .setSoTimeout(5, TimeUnit.SECONDS)
+ .build())
.create();
HttpCoreContext coreContext = HttpCoreContext.create();
HttpHost target = new HttpHost("httpbin.org");
String[] requestUris = new String[] {"/", "/ip", "/user-agent", "/headers"};
- SocketConfig socketConfig = SocketConfig.custom()
- .setSoTimeout(5, TimeUnit.SECONDS)
- .build();
-
for (int i = 0; i < requestUris.length; i++) {
String requestUri = requestUris[i];
ClassicHttpRequest request = new BasicClassicHttpRequest("GET", target, requestUri);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java
index d81f616..6c1a0ad 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java
@@ -39,10 +39,10 @@ import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.config.SocketConfig;
import org.apache.hc.core5.http.impl.Http1StreamListener;
import org.apache.hc.core5.http.impl.bootstrap.HttpRequester;
import org.apache.hc.core5.http.impl.bootstrap.RequesterBootstrap;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.io.entity.InputStreamEntity;
@@ -83,6 +83,9 @@ public class ClassicPostExecutionExample {
}
})
+ .setSocketConfig(SocketConfig.custom()
+ .setSoTimeout(5, TimeUnit.SECONDS)
+ .build())
.create();
HttpCoreContext coreContext = HttpCoreContext.create();
HttpHost target = new HttpHost("httpbin.org");
@@ -101,10 +104,6 @@ public class ClassicPostExecutionExample {
ContentType.APPLICATION_OCTET_STREAM)
};
- SocketConfig socketConfig = SocketConfig.custom()
- .setSoTimeout(5, TimeUnit.SECONDS)
- .build();
-
String requestUri = "/post";
for (int i = 0; i < requestBodies.length; i++) {
ClassicHttpRequest request = new BasicClassicHttpRequest("POST", target,requestUri);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java
index 112b517..1d83848 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java
@@ -34,9 +34,9 @@ import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.config.SocketConfig;
import org.apache.hc.core5.http.impl.bootstrap.HttpRequester;
import org.apache.hc.core5.http.impl.bootstrap.RequesterBootstrap;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.io.entity.HttpEntityWithTrailers;
import org.apache.hc.core5.http.io.entity.StringEntity;
@@ -50,7 +50,11 @@ import org.apache.hc.core5.util.Timeout;
*/
public class ClassicPostWithTrailersExecutionExample {
public static void main(String[] args) throws Exception {
- HttpRequester httpRequester = RequesterBootstrap.bootstrap().create();
+ HttpRequester httpRequester = RequesterBootstrap.bootstrap()
+ .setSocketConfig(SocketConfig.custom()
+ .setSoTimeout(5, TimeUnit.SECONDS)
+ .build())
+ .create();
HttpCoreContext coreContext = HttpCoreContext.create();
HttpHost target = new HttpHost("httpbin.org");
@@ -62,10 +66,6 @@ public class ClassicPostWithTrailersExecutionExample {
new BasicHeader("t1","Hello world"));
request.setEntity(requestBody);
- SocketConfig socketConfig = SocketConfig.custom()
- .setSoTimeout(5, TimeUnit.SECONDS)
- .build();
-
System.out.println(">> Request URI: " + request.getUri());
try (ClassicHttpResponse response = httpRequester.execute(target, request, Timeout.ofSeconds(5), coreContext)) {
System.out.println(requestUri + "->" + response.getCode());
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
index a93d744..e0c4a50 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
@@ -35,7 +35,7 @@ import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java b/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java
deleted file mode 100644
index f01efa1..0000000
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.core5.http.config;
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.hc.core5.annotation.Contract;
-import org.apache.hc.core5.annotation.ThreadingBehavior;
-import org.apache.hc.core5.util.Args;
-import org.apache.hc.core5.util.TimeValue;
-import org.apache.hc.core5.util.Timeout;
-
-/**
- * Socket configuration.
- *
- * @since 4.3
- */
-@Contract(threading = ThreadingBehavior.IMMUTABLE)
-public class SocketConfig {
-
- public static final SocketConfig DEFAULT = new Builder().build();
-
- private final Timeout soTimeout;
- private final boolean soReuseAddress;
- private final TimeValue soLinger;
- private final boolean soKeepAlive;
- private final boolean tcpNoDelay;
- private final int sndBufSize;
- private final int rcvBufSize;
- private final int backlogSize;
-
- SocketConfig(
- final Timeout soTimeout,
- final boolean soReuseAddress,
- final TimeValue soLinger,
- final boolean soKeepAlive,
- final boolean tcpNoDelay,
- final int sndBufSize,
- final int rcvBufSize,
- final int backlogSize) {
- super();
- this.soTimeout = soTimeout;
- this.soReuseAddress = soReuseAddress;
- this.soLinger = soLinger;
- this.soKeepAlive = soKeepAlive;
- this.tcpNoDelay = tcpNoDelay;
- this.sndBufSize = sndBufSize;
- this.rcvBufSize = rcvBufSize;
- this.backlogSize = backlogSize;
- }
-
- /**
- * Determines the default socket timeout value for blocking I/O operations.
- * <p>
- * Default: {@code 0} (no timeout)
- * </p>
- *
- * @return the default socket timeout value for blocking I/O operations.
- * @see java.net.SocketOptions#SO_TIMEOUT
- */
- public Timeout getSoTimeout() {
- return soTimeout;
- }
-
- /**
- * Determines the default value of the {@link java.net.SocketOptions#SO_REUSEADDR} parameter
- * for newly created sockets.
- * <p>
- * Default: {@code false}
- * </p>
- *
- * @return the default value of the {@link java.net.SocketOptions#SO_REUSEADDR} parameter.
- * @see java.net.SocketOptions#SO_REUSEADDR
- */
- public boolean isSoReuseAddress() {
- return soReuseAddress;
- }
-
- /**
- * Determines the default value of the {@link java.net.SocketOptions#SO_LINGER} parameter
- * for newly created sockets.
- * <p>
- * Default: {@code -1}
- * </p>
- *
- * @return the default value of the {@link java.net.SocketOptions#SO_LINGER} parameter.
- * @see java.net.SocketOptions#SO_LINGER
- */
- public TimeValue getSoLinger() {
- return soLinger;
- }
-
- /**
- * Determines the default value of the {@link java.net.SocketOptions#SO_KEEPALIVE} parameter
- * for newly created sockets.
- * <p>
- * Default: {@code false}
- * </p>
- *
- * @return the default value of the {@link java.net.SocketOptions#SO_KEEPALIVE} parameter.
- * @see java.net.SocketOptions#SO_KEEPALIVE
- */
- public boolean isSoKeepAlive() {
- return soKeepAlive;
- }
-
- /**
- * Determines the default value of the {@link java.net.SocketOptions#TCP_NODELAY} parameter
- * for newly created sockets.
- * <p>
- * Default: {@code false}
- * </p>
- *
- * @return the default value of the {@link java.net.SocketOptions#TCP_NODELAY} parameter.
- * @see java.net.SocketOptions#TCP_NODELAY
- */
- public boolean isTcpNoDelay() {
- return tcpNoDelay;
- }
-
- /**
- * Determines the default value of the {@link java.net.SocketOptions#SO_SNDBUF} parameter
- * for newly created sockets.
- * <p>
- * Default: {@code 0} (system default)
- * </p>
- *
- * @return the default value of the {@link java.net.SocketOptions#SO_SNDBUF} parameter.
- * @see java.net.SocketOptions#SO_SNDBUF
- * @since 4.4
- */
- public int getSndBufSize() {
- return sndBufSize;
- }
-
- /**
- * Determines the default value of the {@link java.net.SocketOptions#SO_RCVBUF} parameter
- * for newly created sockets.
- * <p>
- * Default: {@code 0} (system default)
- * </p>
- *
- * @return the default value of the {@link java.net.SocketOptions#SO_RCVBUF} parameter.
- * @see java.net.SocketOptions#SO_RCVBUF
- * @since 4.4
- */
- public int getRcvBufSize() {
- return rcvBufSize;
- }
-
- /**
- * Determines the maximum queue length for incoming connection indications
- * (a request to connect) also known as server socket backlog.
- * <p>
- * Default: {@code 0} (system default)
- * </p>
- * @return the maximum queue length for incoming connection indications
- * @since 4.4
- */
- public int getBacklogSize() {
- return backlogSize;
- }
-
- @Override
- public String toString() {
- final StringBuilder builder = new StringBuilder();
- builder.append("[soTimeout=").append(this.soTimeout)
- .append(", soReuseAddress=").append(this.soReuseAddress)
- .append(", soLinger=").append(this.soLinger)
- .append(", soKeepAlive=").append(this.soKeepAlive)
- .append(", tcpNoDelay=").append(this.tcpNoDelay)
- .append(", sndBufSize=").append(this.sndBufSize)
- .append(", rcvBufSize=").append(this.rcvBufSize)
- .append(", backlogSize=").append(this.backlogSize)
- .append("]");
- return builder.toString();
- }
-
- public static SocketConfig.Builder custom() {
- return new Builder();
- }
-
- public static SocketConfig.Builder copy(final SocketConfig config) {
- Args.notNull(config, "Socket config");
- return new Builder()
- .setSoTimeout(config.getSoTimeout())
- .setSoReuseAddress(config.isSoReuseAddress())
- .setSoLinger(config.getSoLinger())
- .setSoKeepAlive(config.isSoKeepAlive())
- .setTcpNoDelay(config.isTcpNoDelay())
- .setSndBufSize(config.getSndBufSize())
- .setRcvBufSize(config.getRcvBufSize())
- .setBacklogSize(config.getBacklogSize());
- }
-
- public static class Builder {
-
- private Timeout soTimeout;
- private boolean soReuseAddress;
- private TimeValue soLinger;
- private boolean soKeepAlive;
- private boolean tcpNoDelay;
- private int sndBufSize;
- private int rcvBufSize;
- private int backlogSize;
-
- Builder() {
- this.soTimeout = Timeout.ZERO_MILLISECONDS;
- this.soReuseAddress = false;
- this.soLinger = TimeValue.NEG_ONE_SECONDS;
- this.soKeepAlive = false;
- this.tcpNoDelay = true;
- this.sndBufSize = 0;
- this.rcvBufSize = 0;
- this.backlogSize = 0;
- }
-
- public Builder setSoTimeout(final int soTimeout, final TimeUnit timeUnit) {
- this.soTimeout = Timeout.of(soTimeout, timeUnit);
- return this;
- }
-
- public Builder setSoTimeout(final Timeout soTimeout) {
- this.soTimeout = soTimeout;
- return this;
- }
-
- public Builder setSoReuseAddress(final boolean soReuseAddress) {
- this.soReuseAddress = soReuseAddress;
- return this;
- }
-
- public Builder setSoLinger(final int soLinger, final TimeUnit timeUnit) {
- this.soLinger = Timeout.of(soLinger, timeUnit);
- return this;
- }
-
- public Builder setSoLinger(final TimeValue soLinger) {
- this.soLinger = soLinger;
- return this;
- }
-
- public Builder setSoKeepAlive(final boolean soKeepAlive) {
- this.soKeepAlive = soKeepAlive;
- return this;
- }
-
- public Builder setTcpNoDelay(final boolean tcpNoDelay) {
- this.tcpNoDelay = tcpNoDelay;
- return this;
- }
-
- /**
- * @since 4.4
- */
- public Builder setSndBufSize(final int sndBufSize) {
- this.sndBufSize = sndBufSize;
- return this;
- }
-
- /**
- * @since 4.4
- */
- public Builder setRcvBufSize(final int rcvBufSize) {
- this.rcvBufSize = rcvBufSize;
- return this;
- }
-
- /**
- * @since 4.4
- */
- public Builder setBacklogSize(final int backlogSize) {
- this.backlogSize = backlogSize;
- return this;
- }
-
- public SocketConfig build() {
- return new SocketConfig(
- Timeout.defaultsToDisabled(soTimeout),
- soReuseAddress,
- soLinger != null ? soLinger : TimeValue.NEG_ONE_SECONDS,
- soKeepAlive, tcpNoDelay, sndBufSize, rcvBufSize, backlogSize);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
index 7be2e36..0aca058 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
@@ -51,7 +51,7 @@ import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.DefaultAddressResolver;
import org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnectionFactory;
import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpServer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpServer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpServer.java
index bbf4897..a71c1cb 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpServer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpServer.java
@@ -44,7 +44,7 @@ import org.apache.hc.core5.http.ExceptionListener;
import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.io.DefaultBHttpServerConnection;
import org.apache.hc.core5.http.impl.io.DefaultBHttpServerConnectionFactory;
import org.apache.hc.core5.http.impl.io.HttpService;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequestListener.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequestListener.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequestListener.java
index f477f07..39def63 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequestListener.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequestListener.java
@@ -33,7 +33,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.hc.core5.http.ExceptionListener;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.io.HttpService;
import org.apache.hc.core5.http.io.HttpConnectionFactory;
import org.apache.hc.core5.http.io.HttpServerConnection;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequesterBootstrap.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequesterBootstrap.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequesterBootstrap.java
index cb6700a..cdc18bb 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequesterBootstrap.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequesterBootstrap.java
@@ -33,7 +33,7 @@ import org.apache.hc.core5.http.ConnectionReuseStrategy;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.DefaultAddressResolver;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
import org.apache.hc.core5.http.impl.Http1StreamListener;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java
index 1382368..0c875a2 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java
@@ -42,7 +42,7 @@ import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.config.NamedElementChain;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
import org.apache.hc.core5.http.impl.Http1StreamListener;
import org.apache.hc.core5.http.impl.HttpProcessors;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9c0b2811/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java
new file mode 100644
index 0000000..65fc3b5
--- /dev/null
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java
@@ -0,0 +1,312 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.http.io;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.util.Args;
+import org.apache.hc.core5.util.TimeValue;
+import org.apache.hc.core5.util.Timeout;
+
+/**
+ * Socket configuration.
+ *
+ * @since 4.3
+ */
+@Contract(threading = ThreadingBehavior.IMMUTABLE)
+public class SocketConfig {
+
+ public static final SocketConfig DEFAULT = new Builder().build();
+
+ private final Timeout soTimeout;
+ private final boolean soReuseAddress;
+ private final TimeValue soLinger;
+ private final boolean soKeepAlive;
+ private final boolean tcpNoDelay;
+ private final int sndBufSize;
+ private final int rcvBufSize;
+ private final int backlogSize;
+
+ SocketConfig(
+ final Timeout soTimeout,
+ final boolean soReuseAddress,
+ final TimeValue soLinger,
+ final boolean soKeepAlive,
+ final boolean tcpNoDelay,
+ final int sndBufSize,
+ final int rcvBufSize,
+ final int backlogSize) {
+ super();
+ this.soTimeout = soTimeout;
+ this.soReuseAddress = soReuseAddress;
+ this.soLinger = soLinger;
+ this.soKeepAlive = soKeepAlive;
+ this.tcpNoDelay = tcpNoDelay;
+ this.sndBufSize = sndBufSize;
+ this.rcvBufSize = rcvBufSize;
+ this.backlogSize = backlogSize;
+ }
+
+ /**
+ * Determines the default socket timeout value for blocking I/O operations.
+ * <p>
+ * Default: {@code 0} (no timeout)
+ * </p>
+ *
+ * @return the default socket timeout value for blocking I/O operations.
+ * @see java.net.SocketOptions#SO_TIMEOUT
+ */
+ public Timeout getSoTimeout() {
+ return soTimeout;
+ }
+
+ /**
+ * Determines the default value of the {@link java.net.SocketOptions#SO_REUSEADDR} parameter
+ * for newly created sockets.
+ * <p>
+ * Default: {@code false}
+ * </p>
+ *
+ * @return the default value of the {@link java.net.SocketOptions#SO_REUSEADDR} parameter.
+ * @see java.net.SocketOptions#SO_REUSEADDR
+ */
+ public boolean isSoReuseAddress() {
+ return soReuseAddress;
+ }
+
+ /**
+ * Determines the default value of the {@link java.net.SocketOptions#SO_LINGER} parameter
+ * for newly created sockets.
+ * <p>
+ * Default: {@code -1}
+ * </p>
+ *
+ * @return the default value of the {@link java.net.SocketOptions#SO_LINGER} parameter.
+ * @see java.net.SocketOptions#SO_LINGER
+ */
+ public TimeValue getSoLinger() {
+ return soLinger;
+ }
+
+ /**
+ * Determines the default value of the {@link java.net.SocketOptions#SO_KEEPALIVE} parameter
+ * for newly created sockets.
+ * <p>
+ * Default: {@code false}
+ * </p>
+ *
+ * @return the default value of the {@link java.net.SocketOptions#SO_KEEPALIVE} parameter.
+ * @see java.net.SocketOptions#SO_KEEPALIVE
+ */
+ public boolean isSoKeepAlive() {
+ return soKeepAlive;
+ }
+
+ /**
+ * Determines the default value of the {@link java.net.SocketOptions#TCP_NODELAY} parameter
+ * for newly created sockets.
+ * <p>
+ * Default: {@code false}
+ * </p>
+ *
+ * @return the default value of the {@link java.net.SocketOptions#TCP_NODELAY} parameter.
+ * @see java.net.SocketOptions#TCP_NODELAY
+ */
+ public boolean isTcpNoDelay() {
+ return tcpNoDelay;
+ }
+
+ /**
+ * Determines the default value of the {@link java.net.SocketOptions#SO_SNDBUF} parameter
+ * for newly created sockets.
+ * <p>
+ * Default: {@code 0} (system default)
+ * </p>
+ *
+ * @return the default value of the {@link java.net.SocketOptions#SO_SNDBUF} parameter.
+ * @see java.net.SocketOptions#SO_SNDBUF
+ * @since 4.4
+ */
+ public int getSndBufSize() {
+ return sndBufSize;
+ }
+
+ /**
+ * Determines the default value of the {@link java.net.SocketOptions#SO_RCVBUF} parameter
+ * for newly created sockets.
+ * <p>
+ * Default: {@code 0} (system default)
+ * </p>
+ *
+ * @return the default value of the {@link java.net.SocketOptions#SO_RCVBUF} parameter.
+ * @see java.net.SocketOptions#SO_RCVBUF
+ * @since 4.4
+ */
+ public int getRcvBufSize() {
+ return rcvBufSize;
+ }
+
+ /**
+ * Determines the maximum queue length for incoming connection indications
+ * (a request to connect) also known as server socket backlog.
+ * <p>
+ * Default: {@code 0} (system default)
+ * </p>
+ * @return the maximum queue length for incoming connection indications
+ * @since 4.4
+ */
+ public int getBacklogSize() {
+ return backlogSize;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("[soTimeout=").append(this.soTimeout)
+ .append(", soReuseAddress=").append(this.soReuseAddress)
+ .append(", soLinger=").append(this.soLinger)
+ .append(", soKeepAlive=").append(this.soKeepAlive)
+ .append(", tcpNoDelay=").append(this.tcpNoDelay)
+ .append(", sndBufSize=").append(this.sndBufSize)
+ .append(", rcvBufSize=").append(this.rcvBufSize)
+ .append(", backlogSize=").append(this.backlogSize)
+ .append("]");
+ return builder.toString();
+ }
+
+ public static SocketConfig.Builder custom() {
+ return new Builder();
+ }
+
+ public static SocketConfig.Builder copy(final SocketConfig config) {
+ Args.notNull(config, "Socket config");
+ return new Builder()
+ .setSoTimeout(config.getSoTimeout())
+ .setSoReuseAddress(config.isSoReuseAddress())
+ .setSoLinger(config.getSoLinger())
+ .setSoKeepAlive(config.isSoKeepAlive())
+ .setTcpNoDelay(config.isTcpNoDelay())
+ .setSndBufSize(config.getSndBufSize())
+ .setRcvBufSize(config.getRcvBufSize())
+ .setBacklogSize(config.getBacklogSize());
+ }
+
+ public static class Builder {
+
+ private Timeout soTimeout;
+ private boolean soReuseAddress;
+ private TimeValue soLinger;
+ private boolean soKeepAlive;
+ private boolean tcpNoDelay;
+ private int sndBufSize;
+ private int rcvBufSize;
+ private int backlogSize;
+
+ Builder() {
+ this.soTimeout = Timeout.ZERO_MILLISECONDS;
+ this.soReuseAddress = false;
+ this.soLinger = TimeValue.NEG_ONE_SECONDS;
+ this.soKeepAlive = false;
+ this.tcpNoDelay = true;
+ this.sndBufSize = 0;
+ this.rcvBufSize = 0;
+ this.backlogSize = 0;
+ }
+
+ public Builder setSoTimeout(final int soTimeout, final TimeUnit timeUnit) {
+ this.soTimeout = Timeout.of(soTimeout, timeUnit);
+ return this;
+ }
+
+ public Builder setSoTimeout(final Timeout soTimeout) {
+ this.soTimeout = soTimeout;
+ return this;
+ }
+
+ public Builder setSoReuseAddress(final boolean soReuseAddress) {
+ this.soReuseAddress = soReuseAddress;
+ return this;
+ }
+
+ public Builder setSoLinger(final int soLinger, final TimeUnit timeUnit) {
+ this.soLinger = Timeout.of(soLinger, timeUnit);
+ return this;
+ }
+
+ public Builder setSoLinger(final TimeValue soLinger) {
+ this.soLinger = soLinger;
+ return this;
+ }
+
+ public Builder setSoKeepAlive(final boolean soKeepAlive) {
+ this.soKeepAlive = soKeepAlive;
+ return this;
+ }
+
+ public Builder setTcpNoDelay(final boolean tcpNoDelay) {
+ this.tcpNoDelay = tcpNoDelay;
+ return this;
+ }
+
+ /**
+ * @since 4.4
+ */
+ public Builder setSndBufSize(final int sndBufSize) {
+ this.sndBufSize = sndBufSize;
+ return this;
+ }
+
+ /**
+ * @since 4.4
+ */
+ public Builder setRcvBufSize(final int rcvBufSize) {
+ this.rcvBufSize = rcvBufSize;
+ return this;
+ }
+
+ /**
+ * @since 4.4
+ */
+ public Builder setBacklogSize(final int backlogSize) {
+ this.backlogSize = backlogSize;
+ return this;
+ }
+
+ public SocketConfig build() {
+ return new SocketConfig(
+ Timeout.defaultsToDisabled(soTimeout),
+ soReuseAddress,
+ soLinger != null ? soLinger : TimeValue.NEG_ONE_SECONDS,
+ soKeepAlive, tcpNoDelay, sndBufSize, rcvBufSize, backlogSize);
+ }
+
+ }
+
+}