- Remove redundant parentheses
- No need to nest into else clause
- Add missing @Override
This commit is contained in:
Gary Gregory 2024-08-26 10:49:26 -04:00
parent 648690fdfd
commit a1eed8084d
33 changed files with 382 additions and 65 deletions

View File

@ -49,6 +49,8 @@ public interface AsyncExecCallback {
* @param entityDetails the response entity details or {@code null} if the response
* does not enclose an entity.
* @return the data consumer to be used for processing of incoming response message body.
* @throws HttpException If a protocol error occurs.
* @throws IOException If an I/O error occurs.
*/
AsyncDataConsumer handleResponse(
HttpResponse response,
@ -58,6 +60,8 @@ public interface AsyncExecCallback {
* Triggered to signal receipt of an intermediate response message.
*
* @param response the intermediate response message.
* @throws HttpException If a protocol error occurs.
* @throws IOException If an I/O error occurs.
*/
void handleInformationResponse(HttpResponse response) throws HttpException, IOException;

View File

@ -72,6 +72,8 @@ public interface AsyncExecChainHandler {
* @param scope the execution scope .
* @param chain the next element in the request execution chain.
* @param asyncExecCallback the execution callback.
* @throws HttpException If a protocol error occurs.
* @throws IOException If an I/O error occurs.
*/
void execute(
HttpRequest request,

View File

@ -135,7 +135,9 @@ public interface AsyncExecRuntime {
}
/**
* Returns information about the underlying endpoint when connected or {@code null} otherwise.
* Gets information about the underlying endpoint when connected or {@code null} otherwise.
*
* @return the underlying endpoint or {@code null}
*/
default EndpointInfo getEndpointInfo() {
return null;

View File

@ -52,6 +52,8 @@ public abstract class AbstractBinPushConsumer extends AbstractBinDataConsumer im
* @param response the response message head
* @param contentType the content type of the response body,
* or {@code null} if the response does not enclose a response entity.
* @throws HttpException If a protocol error occurs.
* @throws IOException If an I/O error occurs.
*/
protected abstract void start(HttpRequest promise, HttpResponse response, ContentType contentType) throws HttpException, IOException;

View File

@ -56,6 +56,8 @@ public abstract class AbstractBinResponseConsumer<T> extends AbstractBinDataCons
* @param response the response message head
* @param contentType the content type of the response body,
* or {@code null} if the response does not enclose a response entity.
* @throws HttpException If a protocol error occurs.
* @throws IOException If an I/O error occurs.
*/
protected abstract void start(HttpResponse response, ContentType contentType) throws HttpException, IOException;

View File

@ -68,6 +68,8 @@ public abstract class AbstractCharPushConsumer extends AbstractCharDataConsumer
* @param response the response message head
* @param contentType the content type of the response body,
* or {@code null} if the response does not enclose a response entity.
* @throws HttpException If a protocol error occurs.
* @throws IOException If an I/O error occurs.
*/
protected abstract void start(HttpRequest promise, HttpResponse response, ContentType contentType) throws HttpException, IOException;

View File

@ -71,6 +71,8 @@ public abstract class AbstractCharResponseConsumer<T> extends AbstractCharDataCo
* @param response the response message head
* @param contentType the content type of the response body,
* or {@code null} if the response does not enclose a response entity.
* @throws HttpException If a protocol error occurs.
* @throws IOException If an I/O error occurs.
*/
protected abstract void start(HttpResponse response, ContentType contentType) throws HttpException, IOException;

View File

@ -65,125 +65,280 @@ public final class BasicHttpRequests {
return create(Method.normalizedValueOf(method), uri);
}
/**
* Creates a new DELETE {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest delete(final String uri) {
return delete(URI.create(uri));
}
/**
* Creates a new DELETE {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest delete(final URI uri) {
return create(Method.DELETE, uri);
}
/**
* Creates a new DELETE {@link BasicHttpRequest}.
*
* @param host HTTP host.
* @param path request path.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest delete(final HttpHost host, final String path) {
return create(Method.DELETE, host, path);
}
/**
* Creates a new GET {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest get(final String uri) {
return get(URI.create(uri));
}
/**
* Creates a new GET {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest get(final URI uri) {
return create(Method.GET, uri);
}
/**
* Creates a new HEAD {@link BasicHttpRequest}.
*
* @param host HTTP host.
* @param path request path.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest get(final HttpHost host, final String path) {
return create(Method.GET, host, path);
}
/**
* Creates a new HEAD {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest head(final String uri) {
return head(URI.create(uri));
}
/**
* Creates a new HEAD {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest head(final URI uri) {
return create(Method.HEAD, uri);
}
/**
* Creates a new HEAD {@link BasicHttpRequest}.
*
* @param host HTTP host.
* @param path request path.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest head(final HttpHost host, final String path) {
return create(Method.HEAD, host, path);
}
/**
* Creates a new OPTIONS {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest options(final String uri) {
return options(URI.create(uri));
}
/**
* Creates a new OPTIONS {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest options(final URI uri) {
return create(Method.OPTIONS, uri);
}
/**
* Creates a new OPTIONS {@link BasicHttpRequest}.
*
* @param host HTTP host.
* @param path request path.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest options(final HttpHost host, final String path) {
return create(Method.OPTIONS, host, path);
}
/**
* Creates a new PATCH {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest patch(final String uri) {
return patch(URI.create(uri));
}
/**
* Creates a new PATCH {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest patch(final URI uri) {
return create(Method.PATCH, uri);
}
/**
* Creates a new PATCH {@link BasicHttpRequest}.
*
* @param host HTTP host.
* @param path request path.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest patch(final HttpHost host, final String path) {
return create(Method.PATCH, host, path);
}
/**
* Creates a new POST {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest post(final String uri) {
return post(URI.create(uri));
}
/**
* Creates a new POST {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest post(final URI uri) {
return create(Method.POST, uri);
}
/**
* Creates a new POST {@link BasicHttpRequest}.
*
* @param host HTTP host.
* @param path request path.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest post(final HttpHost host, final String path) {
return create(Method.POST, host, path);
}
/**
* Creates a new PUT {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest put(final String uri) {
return put(URI.create(uri));
}
/**
* Creates a new PUT {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest put(final URI uri) {
return create(Method.PUT, uri);
}
/**
* Creates a new PUT {@link BasicHttpRequest}.
*
* @param host HTTP host.
* @param path request path.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest put(final HttpHost host, final String path) {
return create(Method.PUT, host, path);
}
/**
* Creates a new TRACE {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest trace(final String uri) {
return trace(URI.create(uri));
}
/**
* Creates a new TRACE {@link BasicHttpRequest}.
*
* @param uri a non-null URI.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest trace(final URI uri) {
return create(Method.TRACE, uri);
}
/**
* Creates a new TRACE {@link BasicHttpRequest}.
*
* @param host HTTP host.
* @param path request path.
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest trace(final HttpHost host, final String path) {
return create(Method.TRACE, host, path);
}
/**
* Creates a request object of the exact subclass of {@link BasicHttpRequest}.
* Creates a new {@link BasicHttpRequest}.
*
* @param method a non-null HTTP method.
* @param uri a non-null URI String.
* @return a new subclass of BasicHttpRequest
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest create(final Method method, final String uri) {
return create(method, URI.create(uri));
}
/**
* Creates a request object of the exact subclass of {@link BasicHttpRequest}.
* Creates a new {@link BasicHttpRequest}.
*
* @param method a non-null HTTP method.
* @param uri a non-null URI.
* @return a new subclass of BasicHttpRequest
* @return a new BasicHttpRequest
*/
public static BasicHttpRequest create(final Method method, final URI uri) {
return new BasicHttpRequest(method, uri);
}
/**
* Creates a request object of the exact subclass of {@link BasicHttpRequest}.
* Creates a new {@link BasicHttpRequest}.
*
* @param method a non-null HTTP method.
* @param host HTTP host.
* @param path request path.
* @return a new subclass of BasicHttpRequest

View File

@ -45,21 +45,47 @@ public class ConfigurableHttpRequest extends BasicHttpRequest implements Configu
private static final long serialVersionUID = 1L;
private RequestConfig requestConfig;
/**
* Constructs a new request message with the given method and request path.
*
* @param method request method.
* @param path request path.
*/
public ConfigurableHttpRequest(final String method, final String path) {
super(method, path);
}
/**
* Constructs a new request message with the given method, host, and request path.
*
* @param method request method.
* @param host request host.
* @param path request path.
*/
public ConfigurableHttpRequest(final String method, final HttpHost host, final String path) {
super(method, host, path);
}
/**
* Constructs a new request message with the given method, scheme, authority, and request path.
*
* @param method request method.
* @param scheme request host.
* @param authority request URI authority.
* @param path request path.
* @since 5.1
*/
public ConfigurableHttpRequest(final String method, final String scheme, final URIAuthority authority, final String path) {
super(method, scheme, authority, path);
}
/**
* Constructs a new request message with the given method, and request URI.
*
* @param method request method.
* @param requestUri request URI.
* @since 5.1
*/
public ConfigurableHttpRequest(final String method, final URI requestUri) {
super(method, requestUri);
}
@ -69,6 +95,11 @@ public class ConfigurableHttpRequest extends BasicHttpRequest implements Configu
return requestConfig;
}
/**
* Sets the request configuration.
*
* @param requestConfig the request configuration.
*/
public void setConfig(final RequestConfig requestConfig) {
this.requestConfig = requestConfig;
}

View File

@ -65,10 +65,20 @@ public final class SimpleBody {
return new SimpleBody(body, null, contentType);
}
/**
* Gets the content type.
*
* @return the content type.
*/
public ContentType getContentType() {
return contentType;
}
/**
* Gets the body as a byte array.
*
* @return the body as a byte array.
*/
public byte[] getBodyBytes() {
if (bodyAsBytes != null) {
return bodyAsBytes;
@ -80,19 +90,33 @@ public final class SimpleBody {
}
}
/**
* Gets the body as a String.
*
* @return the body as a String.
*/
public String getBodyText() {
if (bodyAsBytes != null) {
final Charset charset = (contentType != null ? contentType : ContentType.DEFAULT_TEXT).getCharset();
return new String(bodyAsBytes, charset != null ? charset : StandardCharsets.US_ASCII);
} else {
return bodyAsText;
}
return bodyAsText;
}
/**
* Tests whether the body is currently cached as a String.
*
* @return whether the body is currently cached as a String.
*/
public boolean isText() {
return bodyAsText != null;
}
/**
* Tests whether the body is currently cached as a byte array.
*
* @return whether the body is currently cached as a byte array.
*/
public boolean isBytes() {
return bodyAsBytes != null;
}

View File

@ -58,6 +58,11 @@ public final class SimpleHttpRequest extends ConfigurableHttpRequest {
private SimpleBody body;
/**
* Creates a new request message with the given method and request path.
*
* @param method request method.
* @param uri request URI.
* @return a new SimpleHttpRequest.
* @since 5.1
*/
public static SimpleHttpRequest create(final String method, final String uri) {
@ -65,6 +70,11 @@ public final class SimpleHttpRequest extends ConfigurableHttpRequest {
}
/**
* Creates a new request message with the given method and request path.
*
* @param method request method.
* @param uri request URI.
* @return a new SimpleHttpRequest.
* @since 5.1
*/
public static SimpleHttpRequest create(final String method, final URI uri) {
@ -72,6 +82,11 @@ public final class SimpleHttpRequest extends ConfigurableHttpRequest {
}
/**
* Creates a new request message with the given method and request path.
*
* @param method request method.
* @param uri request URI.
* @return a new SimpleHttpRequest.
* @since 5.1
*/
public static SimpleHttpRequest create(final Method method, final URI uri) {
@ -79,6 +94,12 @@ public final class SimpleHttpRequest extends ConfigurableHttpRequest {
}
/**
* Creates a new request message with the given method, host, and request path.
*
* @param method request method.
* @param host request host.
* @param path request path.
* @return a new SimpleHttpRequest.
* @since 5.1
*/
public static SimpleHttpRequest create(final Method method, final HttpHost host, final String path) {
@ -86,6 +107,13 @@ public final class SimpleHttpRequest extends ConfigurableHttpRequest {
}
/**
* Creates a new request message with the given method, scheme, authority, and request path.
*
* @param method request method.
* @param scheme request host.
* @param authority request URI authority.
* @param path request path.
* @return a new SimpleHttpRequest.
* @since 5.1
*/
public static SimpleHttpRequest create(final String method, final String scheme, final URIAuthority authority, final String path) {
@ -93,6 +121,10 @@ public final class SimpleHttpRequest extends ConfigurableHttpRequest {
}
/**
* Copies the given HttpRequest.
*
* @param original the source to copy.
* @return a new SimpleHttpRequest.
* @deprecated Use {@link SimpleRequestBuilder}
*/
@Deprecated
@ -108,19 +140,43 @@ public final class SimpleHttpRequest extends ConfigurableHttpRequest {
return copy;
}
/**
* Constructs a new request message with the given method and request path.
*
* @param method request method.
* @param path request path.
*/
public SimpleHttpRequest(final String method, final String path) {
super(method, path);
}
/**
* Constructs a new request message with the given method, host, and request path.
*
* @param method request method.
* @param host request host.
* @param path request path.
*/
public SimpleHttpRequest(final String method, final HttpHost host, final String path) {
super(method, host, path);
}
/**
* Constructs a new request message with the given method, and request URI.
*
* @param method request method.
* @param requestUri request URI.
* @since 5.1
*/
public SimpleHttpRequest(final String method, final URI requestUri) {
super(method, requestUri);
}
/**
* Constructs a new request message with the given method, and request URI.
*
* @param method request method.
* @param requestUri request URI.
* @since 5.1
*/
public SimpleHttpRequest(final Method method, final URI requestUri) {
@ -128,6 +184,11 @@ public final class SimpleHttpRequest extends ConfigurableHttpRequest {
}
/**
* Constructs a new request message with the given method, host, and request path.
*
* @param method request method.
* @param host request host.
* @param path request path.
* @since 5.1
*/
public SimpleHttpRequest(final Method method, final HttpHost host, final String path) {
@ -135,36 +196,79 @@ public final class SimpleHttpRequest extends ConfigurableHttpRequest {
}
/**
* Constructs a new request message with the given method, scheme, authority, and request path.
*
* @param method request method.
* @param scheme request host.
* @param authority request URI authority.
* @param path request path.
* @since 5.1
*/
public SimpleHttpRequest(final String method, final String scheme, final URIAuthority authority, final String path) {
super(method, scheme, authority, path);
}
/**
* Sets the message body and content type.
*
* @param body request body.
*/
public void setBody(final SimpleBody body) {
this.body = body;
}
/**
* Sets the message body and content type.
*
* @param bodyBytes request body.
* @param contentType request content type.
*/
public void setBody(final byte[] bodyBytes, final ContentType contentType) {
this.body = SimpleBody.create(bodyBytes, contentType);
}
/**
* Sets the message body and content type.
*
* @param bodyText request body.
* @param contentType request content type.
*/
public void setBody(final String bodyText, final ContentType contentType) {
this.body = SimpleBody.create(bodyText, contentType);
}
/**
* Gets the request body.
*
* @return the request body.
*/
public SimpleBody getBody() {
return body;
}
/**
* Gets the request content type.
*
* @return the request content type.
*/
public ContentType getContentType() {
return body != null ? body.getContentType() : null;
}
/**
* Gets the request body as a String.
*
* @return the request body.
*/
public String getBodyText() {
return body != null ? body.getBodyText() : null;
}
/**
* Gets the request body as a byte array.
*
* @return the request body.
*/
public byte[] getBodyBytes() {
return body != null ? body.getBodyBytes() : null;
}

View File

@ -164,7 +164,7 @@ public final class SimpleHttpRequests {
* Creates a request object of the exact subclass of {@link SimpleHttpRequest}.
*
* @param uri a non-null URI String.
* @return a new subclass of SimpleHttpRequest
* @return a new SimpleHttpRequest.
*/
public static SimpleHttpRequest create(final Method method, final String uri) {
return create(method, URI.create(uri));
@ -173,8 +173,9 @@ public final class SimpleHttpRequests {
/**
* Creates a request object of the exact subclass of {@link SimpleHttpRequest}.
*
* @param method a non-null HTTP method.
* @param uri a non-null URI.
* @return a new subclass of SimpleHttpRequest
* @return a new SimpleHttpRequest.
*/
public static SimpleHttpRequest create(final Method method, final URI uri) {
return new SimpleHttpRequest(method, uri);
@ -183,9 +184,10 @@ public final class SimpleHttpRequests {
/**
* Creates a request object of the exact subclass of {@link SimpleHttpRequest}.
*
* @param method a non-null HTTP method.
* @param host HTTP host.
* @param path request path.
* @return a new subclass of SimpleHttpRequest
* @return a new SimpleHttpRequest.
*/
public static SimpleHttpRequest create(final Method method, final HttpHost host, final String path) {
return new SimpleHttpRequest(method, host, path);

View File

@ -131,9 +131,8 @@ public final class AsyncHttpRequestRetryExec implements AsyncExecChainHandler {
LOG.debug("{} retrying request in {}", exchangeId, state.delay);
}
return new DiscardingEntityConsumer<>();
} else {
return asyncExecCallback.handleResponse(response, entityDetails);
}
return asyncExecCallback.handleResponse(response, entityDetails);
}
@Override

View File

@ -619,7 +619,7 @@ public class H2AsyncClientBuilder {
* @since 5.2
*/
public final H2AsyncClientBuilder setDefaultConnectionConfig(final ConnectionConfig connectionConfig) {
this.connectionConfigResolver = (host) -> connectionConfig;
this.connectionConfigResolver = host -> connectionConfig;
return this;
}

View File

@ -49,8 +49,7 @@ final class LoggingIOSessionDecorator implements Decorator<IOSession> {
final Logger sessionLog = LoggerFactory.getLogger(ioSession.getClass());
if (sessionLog.isDebugEnabled() || WIRE_LOG.isDebugEnabled()) {
return new LoggingIOSession(ioSession, sessionLog, WIRE_LOG);
} else {
return ioSession;
}
return ioSession;
}
}

View File

@ -232,9 +232,8 @@ public class BasicScheme implements AuthScheme, StateHolder<BasicScheme.State>,
public State store() {
if (complete) {
return new State(new HashMap<>(paramMap), credentials);
} else {
return null;
}
return null;
}
@Override

View File

@ -167,9 +167,8 @@ public class BearerScheme implements AuthScheme, StateHolder<BearerScheme.State>
public State store() {
if (complete) {
return new State(new HashMap<>(paramMap), bearerToken);
} else {
return null;
}
return null;
}
@Override

View File

@ -141,9 +141,8 @@ public abstract class GGSSchemeBase implements AuthScheme {
final GSSContext gssContext = createGSSContext(manager, oid, serverName, gssCredential);
if (input != null) {
return gssContext.initSecContext(input, 0, input.length);
} else {
return gssContext.initSecContext(new byte[] {}, 0, 0);
}
return gssContext.initSecContext(new byte[] {}, 0, 0);
}
/**

View File

@ -76,6 +76,7 @@ public class AIMDBackoffManager extends AbstractBackoff {
* @param curr the current pool size
* @return the backed-off pool size, with a minimum value of 1
*/
@Override
protected int getBackedOffPoolSize(final int curr) {
if (curr <= 1) {
return 1;

View File

@ -71,6 +71,7 @@ public class ExponentialBackoffManager extends AbstractBackoff {
* @param curr the current pool size
* @return the new pool size after applying the backoff
*/
@Override
protected int getBackedOffPoolSize(final int curr) {
if (curr <= 1) {
return 1;
@ -84,6 +85,7 @@ public class ExponentialBackoffManager extends AbstractBackoff {
return result;
}
@Override
public void setBackoffFactor(final double rate) {
Args.check(rate > 0.0, "Growth rate must be greater than 0.0");
this.getBackoffFactor().set(rate);

View File

@ -73,9 +73,8 @@ final class HttpRequestFutureTask<V> extends FutureTask<V> {
public long endedTime() {
if (isDone()) {
return callable.getEnded();
} else {
throw new IllegalStateException("Task is not done yet");
}
throw new IllegalStateException("Task is not done yet");
}
/**
@ -85,9 +84,8 @@ final class HttpRequestFutureTask<V> extends FutureTask<V> {
public long requestDuration() {
if (isDone()) {
return endedTime() - startedTime();
} else {
throw new IllegalStateException("Task is not done yet");
}
throw new IllegalStateException("Task is not done yet");
}
/**
@ -96,9 +94,8 @@ final class HttpRequestFutureTask<V> extends FutureTask<V> {
public long taskDuration() {
if (isDone()) {
return endedTime() - scheduledTime();
} else {
throw new IllegalStateException("Task is not done yet");
}
throw new IllegalStateException("Task is not done yet");
}
@Override

View File

@ -144,15 +144,14 @@ public class HttpRequestRetryExec implements ExecChainHandler {
}
currentRequest = ClassicRequestBuilder.copy(scope.originalRequest).build();
continue;
} else {
if (ex instanceof NoHttpResponseException) {
final NoHttpResponseException updatedex = new NoHttpResponseException(
route.getTargetHost().toHostString() + " failed to respond");
updatedex.setStackTrace(ex.getStackTrace());
throw updatedex;
}
throw ex;
}
if (ex instanceof NoHttpResponseException) {
final NoHttpResponseException updatedex = new NoHttpResponseException(
route.getTargetHost().toHostString() + " failed to respond");
updatedex.setStackTrace(ex.getStackTrace());
throw updatedex;
}
throw ex;
}
try {

View File

@ -68,11 +68,7 @@ class RequestEntityProxy implements HttpEntity {
@Override
public boolean isRepeatable() {
if (!consumed) {
return true;
} else {
return original.isRepeatable();
}
return consumed && original.isRepeatable();
}
@Override

View File

@ -253,10 +253,9 @@ public class DefaultHttpClientConnectionOperator implements HttpClientConnection
LOG.debug("{} connection to {} failed ({}); terminating operation", endpointHost, remoteAddress, ex.getClass());
}
throw ConnectExceptionSupport.enhance(ex, endpointHost, remoteAddresses);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("{} connection to {} failed ({}); retrying connection to the next address", endpointHost, remoteAddress, ex.getClass());
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("{} connection to {} failed ({}); retrying connection to the next address", endpointHost, remoteAddress, ex.getClass());
}
}
}

View File

@ -144,9 +144,8 @@ final class DefaultManagedHttpClientConnection
final Socket socket = getSocket();
if (socket instanceof SSLSocket) {
return ((SSLSocket) socket).getSession();
} else {
return null;
}
return null;
}
@Override

View File

@ -591,7 +591,7 @@ public class PoolingHttpClientConnectionManager
* Sets the same {@link SocketConfig} for all routes
*/
public void setDefaultSocketConfig(final SocketConfig config) {
this.socketConfigResolver = (route) -> config;
this.socketConfigResolver = route -> config;
}
/**
@ -609,7 +609,7 @@ public class PoolingHttpClientConnectionManager
* @since 5.2
*/
public void setDefaultConnectionConfig(final ConnectionConfig config) {
this.connectionConfigResolver = (route) -> config;
this.connectionConfigResolver = route -> config;
}
/**
@ -627,7 +627,7 @@ public class PoolingHttpClientConnectionManager
* @since 5.2
*/
public void setDefaultTlsConfig(final TlsConfig config) {
this.tlsConfigResolver = (host) -> config;
this.tlsConfigResolver = host -> config;
}
/**
@ -776,6 +776,7 @@ public class PoolingHttpClientConnectionManager
/**
* @since 5.4
*/
@Override
public ClassicHttpResponse execute(
final String exchangeId,
final ClassicHttpRequest request,

View File

@ -202,7 +202,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
* @return this instance.
*/
public final PoolingHttpClientConnectionManagerBuilder setDefaultSocketConfig(final SocketConfig config) {
this.socketConfigResolver = (route) -> config;
this.socketConfigResolver = route -> config;
return this;
}
@ -225,7 +225,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
* @since 5.2
*/
public final PoolingHttpClientConnectionManagerBuilder setDefaultConnectionConfig(final ConnectionConfig config) {
this.connectionConfigResolver = (route) -> config;
this.connectionConfigResolver = route -> config;
return this;
}
@ -248,7 +248,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
* @since 5.2
*/
public final PoolingHttpClientConnectionManagerBuilder setDefaultTlsConfig(final TlsConfig config) {
this.tlsConfigResolver = (host) -> config;
this.tlsConfigResolver = host -> config;
return this;
}

View File

@ -608,7 +608,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
* @since 5.2
*/
public void setDefaultConnectionConfig(final ConnectionConfig config) {
this.connectionConfigResolver = (route) -> config;
this.connectionConfigResolver = route -> config;
}
/**
@ -626,7 +626,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
* @since 5.2
*/
public void setDefaultTlsConfig(final TlsConfig config) {
this.tlsConfigResolver = (host) -> config;
this.tlsConfigResolver = host -> config;
}
/**

View File

@ -175,7 +175,7 @@ public class PoolingAsyncClientConnectionManagerBuilder {
* @since 5.2
*/
public final PoolingAsyncClientConnectionManagerBuilder setDefaultConnectionConfig(final ConnectionConfig config) {
this.connectionConfigResolver = (route) -> config;
this.connectionConfigResolver = route -> config;
return this;
}
@ -198,7 +198,7 @@ public class PoolingAsyncClientConnectionManagerBuilder {
* @since 5.2
*/
public final PoolingAsyncClientConnectionManagerBuilder setDefaultTlsConfig(final TlsConfig config) {
this.tlsConfigResolver = (host) -> config;
this.tlsConfigResolver = host -> config;
return this;
}

View File

@ -169,9 +169,8 @@ public class HttpClientContext extends HttpCoreContext {
}
if (context instanceof HttpClientContext) {
return (HttpClientContext) context;
} else {
return new Delegate(context);
}
return new Delegate(context);
}
/**

View File

@ -215,9 +215,8 @@ public final class DefaultHostnameVerifier implements HttpClientHostnameVerifier
}
}
return true;
} else {
return false;
}
return false;
}
private static boolean matchIdentity(final String host, final String identity,

View File

@ -68,9 +68,8 @@ public class DnsUtils {
remaining--;
}
return buf.toString();
} else {
return s;
}
return s;
}
}

View File

@ -108,9 +108,8 @@ public final class ETag {
cursor.updatePos(cursor.getPos() + 1);
if (ch == '"') {
break;
} else {
sb.append(ch);
}
sb.append(ch);
}
value = sb.toString();
}