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/12/04 14:56:18 UTC
[1/4] httpcomponents-client git commit: Upgraded HttpCore to version
5.0-beta6
Repository: httpcomponents-client
Updated Branches:
refs/heads/master 4ee9d3107 -> 5797e2475
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/routing/RoutingSupport.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/routing/RoutingSupport.java b/httpclient5/src/main/java/org/apache/hc/client5/http/routing/RoutingSupport.java
index cd01124..0daf168 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/routing/RoutingSupport.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/routing/RoutingSupport.java
@@ -46,7 +46,7 @@ public final class RoutingSupport {
if (scheme == null) {
throw new ProtocolException("Protocol scheme is not specified");
}
- return new HttpHost(authority, scheme);
+ return new HttpHost(scheme, authority);
}
return null;
}
@@ -58,7 +58,7 @@ public final class RoutingSupport {
if (host.getPort() < 0) {
final int port = (schemePortResolver != null ? schemePortResolver: DefaultSchemePortResolver.INSTANCE).resolve(host);
if (port > 0) {
- return new HttpHost(host.getHostName(), port, host.getSchemeName());
+ return new HttpHost(host.getSchemeName(), host.getHostName(), port);
}
}
return host;
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/utils/URIUtils.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/utils/URIUtils.java b/httpclient5/src/main/java/org/apache/hc/client5/http/utils/URIUtils.java
index d22bbe3..b4a2d73 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/utils/URIUtils.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/utils/URIUtils.java
@@ -281,7 +281,7 @@ public class URIUtils {
final String scheme = uri.getScheme();
if (!TextUtils.isBlank(host)) {
try {
- target = new HttpHost(host, port, scheme);
+ target = new HttpHost(scheme, host, port);
} catch (final IllegalArgumentException ignore) {
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthScope.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthScope.java b/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthScope.java
index cd2f1b8..b81926d 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthScope.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthScope.java
@@ -48,7 +48,7 @@ public class TestAuthScope {
@Test
public void testByOrigin() {
- final HttpHost host = new HttpHost("somehost", 8080, "http");
+ final HttpHost host = new HttpHost("http", "somehost", 8080);
final AuthScope authscope = new AuthScope(host);
Assert.assertEquals(null, authscope.getAuthScheme());
Assert.assertEquals("somehost", authscope.getHost());
@@ -70,7 +70,7 @@ public class TestAuthScope {
@Test
public void testByOriginMixedCaseHostname() throws Exception {
- final HttpHost host = new HttpHost("SomeHost", 8080, "http");
+ final HttpHost host = new HttpHost("http", "SomeHost", 8080);
final AuthScope authscope = new AuthScope(host);
Assert.assertEquals("somehost", authscope.getHost());
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/config/TestRequestConfig.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/config/TestRequestConfig.java b/httpclient5/src/test/java/org/apache/hc/client5/http/config/TestRequestConfig.java
index c4d92e2..a4097cd 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/config/TestRequestConfig.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/config/TestRequestConfig.java
@@ -80,8 +80,8 @@ public class TestRequestConfig {
.setContentCompressionEnabled(false)
.build();
final RequestConfig config = RequestConfig.copy(config0).build();
- Assert.assertEquals(TimeValue.ofMillis(33), config.getConnectTimeout());
- Assert.assertEquals(TimeValue.ofMillis(44), config.getConnectionRequestTimeout());
+ Assert.assertEquals(TimeValue.ofMilliseconds(33), config.getConnectTimeout());
+ Assert.assertEquals(TimeValue.ofMilliseconds(44), config.getConnectionRequestTimeout());
Assert.assertEquals(true, config.isExpectContinueEnabled());
Assert.assertEquals(false, config.isAuthenticationEnabled());
Assert.assertEquals(false, config.isRedirectsEnabled());
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestIdleConnectionEvictor.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestIdleConnectionEvictor.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestIdleConnectionEvictor.java
index 1475eb5..061e89f 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestIdleConnectionEvictor.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestIdleConnectionEvictor.java
@@ -44,7 +44,7 @@ public class TestIdleConnectionEvictor {
public void testEvictExpiredAndIdle() throws Exception {
final ConnPoolControl<?> cm = Mockito.mock(ConnPoolControl.class);
final IdleConnectionEvictor connectionEvictor = new IdleConnectionEvictor(cm,
- TimeValue.ofMillis(500), TimeValue.ofSeconds(3));
+ TimeValue.ofMilliseconds(500), TimeValue.ofSeconds(3));
connectionEvictor.start();
Thread.sleep(1000);
@@ -63,7 +63,7 @@ public class TestIdleConnectionEvictor {
public void testEvictExpiredOnly() throws Exception {
final ConnPoolControl<?> cm = Mockito.mock(ConnPoolControl.class);
final IdleConnectionEvictor connectionEvictor = new IdleConnectionEvictor(cm,
- TimeValue.ofMillis(500), null);
+ TimeValue.ofMilliseconds(500), null);
connectionEvictor.start();
Thread.sleep(1000);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestCloseableHttpClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestCloseableHttpClient.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestCloseableHttpClient.java
index 7771f21..0b0b5c5 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestCloseableHttpClient.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestCloseableHttpClient.java
@@ -84,7 +84,7 @@ public class TestCloseableHttpClient {
client.execute(httpget);
Mockito.verify(client).doExecute(
- Mockito.eq(new HttpHost("somehost", 444, "https")),
+ Mockito.eq(new HttpHost("https", "somehost", 444)),
Mockito.same(httpget),
(HttpContext) Mockito.isNull());
}
@@ -105,7 +105,7 @@ public class TestCloseableHttpClient {
final HttpGet httpget = new HttpGet("https://somehost:444/stuff");
Mockito.when(client.doExecute(
- new HttpHost("somehost", 444, "https"), httpget, null)).thenReturn(response);
+ new HttpHost("https", "somehost", 444), httpget, null)).thenReturn(response);
final CloseableHttpResponse result = client.execute(httpget);
Assert.assertSame(response, result);
@@ -116,14 +116,14 @@ public class TestCloseableHttpClient {
final HttpGet httpget = new HttpGet("https://somehost:444/stuff");
Mockito.when(client.doExecute(
- new HttpHost("somehost", 444, "https"), httpget, null)).thenReturn(response);
+ new HttpHost("https", "somehost", 444), httpget, null)).thenReturn(response);
final HttpClientResponseHandler<HttpResponse> handler = Mockito.mock(HttpClientResponseHandler.class);
client.execute(httpget, handler);
Mockito.verify(client).doExecute(
- Mockito.eq(new HttpHost("somehost", 444, "https")),
+ Mockito.eq(new HttpHost("https", "somehost", 444)),
Mockito.same(httpget),
(HttpContext) Mockito.isNull());
Mockito.verify(handler).handleResponse(response);
@@ -135,7 +135,7 @@ public class TestCloseableHttpClient {
final HttpGet httpget = new HttpGet("https://somehost:444/stuff");
Mockito.when(client.doExecute(
- new HttpHost("somehost", 444, "https"), httpget, null)).thenReturn(response);
+ new HttpHost("https", "somehost", 444), httpget, null)).thenReturn(response);
final HttpClientResponseHandler<HttpResponse> handler = Mockito.mock(HttpClientResponseHandler.class);
@@ -145,7 +145,7 @@ public class TestCloseableHttpClient {
client.execute(httpget, handler);
} catch (final IOException ex) {
Mockito.verify(client).doExecute(
- Mockito.eq(new HttpHost("somehost", 444, "https")),
+ Mockito.eq(new HttpHost("https", "somehost", 444)),
Mockito.same(httpget),
(HttpContext) Mockito.isNull());
Mockito.verify(originResponse).close();
@@ -158,7 +158,7 @@ public class TestCloseableHttpClient {
final HttpGet httpget = new HttpGet("https://somehost:444/stuff");
Mockito.when(client.doExecute(
- new HttpHost("somehost", 444, "https"), httpget, null)).thenReturn(response);
+ new HttpHost("https", "somehost", 444), httpget, null)).thenReturn(response);
final HttpClientResponseHandler<HttpResponse> handler = Mockito.mock(HttpClientResponseHandler.class);
@@ -168,7 +168,7 @@ public class TestCloseableHttpClient {
client.execute(httpget, handler);
} catch (final RuntimeException ex) {
Mockito.verify(client).doExecute(
- Mockito.eq(new HttpHost("somehost", 444, "https")),
+ Mockito.eq(new HttpHost("https", "somehost", 444)),
Mockito.same(httpget),
(HttpContext) Mockito.isNull());
Mockito.verify(response).close();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestInternalExecRuntime.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestInternalExecRuntime.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestInternalExecRuntime.java
index 7cc3892..7dd49a5 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestInternalExecRuntime.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestInternalExecRuntime.java
@@ -98,7 +98,7 @@ public class TestInternalExecRuntime {
Assert.assertFalse(execRuntime.isEndpointConnected());
Assert.assertFalse(execRuntime.isConnectionReusable());
- Mockito.verify(leaseRequest).get(Timeout.ofMillis(345));
+ Mockito.verify(leaseRequest).get(Timeout.ofMilliseconds(345));
Mockito.verify(cancellableDependency, Mockito.times(1)).setDependency(leaseRequest);
Mockito.verify(cancellableDependency, Mockito.times(1)).setDependency(execRuntime);
Mockito.verify(cancellableDependency, Mockito.times(2)).setDependency(Mockito.<Cancellable>any());
@@ -199,14 +199,14 @@ public class TestInternalExecRuntime {
execRuntime.acquireEndpoint(route, null, context);
Assert.assertTrue(execRuntime.isEndpointAcquired());
- execRuntime.markConnectionReusable("some state", TimeValue.ofMillis(100000));
+ execRuntime.markConnectionReusable("some state", TimeValue.ofMilliseconds(100000));
execRuntime.releaseEndpoint();
Assert.assertFalse(execRuntime.isEndpointAcquired());
Mockito.verify(connectionEndpoint, Mockito.never()).close();
- Mockito.verify(mgr).release(connectionEndpoint, "some state", TimeValue.ofMillis(100000));
+ Mockito.verify(mgr).release(connectionEndpoint, "some state", TimeValue.ofMilliseconds(100000));
execRuntime.releaseEndpoint();
@@ -226,7 +226,7 @@ public class TestInternalExecRuntime {
execRuntime.acquireEndpoint(route, null, context);
Assert.assertTrue(execRuntime.isEndpointAcquired());
- execRuntime.markConnectionReusable("some state", TimeValue.ofMillis(100000));
+ execRuntime.markConnectionReusable("some state", TimeValue.ofMilliseconds(100000));
execRuntime.markConnectionNonReusable();
execRuntime.releaseEndpoint();
@@ -264,7 +264,7 @@ public class TestInternalExecRuntime {
execRuntime.connectEndpoint(context);
- Mockito.verify(mgr).connect(connectionEndpoint, Timeout.ofMillis(123), context);
+ Mockito.verify(mgr).connect(connectionEndpoint, Timeout.ofMilliseconds(123), context);
}
@Test
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestMainClientExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestMainClientExec.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestMainClientExec.java
index 9b4ef4d..f09fb26 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestMainClientExec.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestMainClientExec.java
@@ -161,13 +161,13 @@ public class TestMainClientExec {
Mockito.<HttpClientContext>any())).thenReturn(true);
Mockito.when(keepAliveStrategy.getKeepAliveDuration(
Mockito.same(response),
- Mockito.<HttpClientContext>any())).thenReturn(TimeValue.ofMillis(678L));
+ Mockito.<HttpClientContext>any())).thenReturn(TimeValue.ofMilliseconds(678L));
final ExecChain.Scope scope = new ExecChain.Scope("test", route, request, endpoint, context);
final ClassicHttpResponse finalResponse = mainClientExec.execute(request, scope, null);
Mockito.verify(endpoint).execute(request, context);
- Mockito.verify(endpoint).markConnectionReusable(null, TimeValue.ofMillis(678L));
+ Mockito.verify(endpoint).markConnectionReusable(null, TimeValue.ofMilliseconds(678L));
Mockito.verify(endpoint, Mockito.never()).releaseEndpoint();
Assert.assertNotNull(finalResponse);
@@ -193,7 +193,7 @@ public class TestMainClientExec {
Mockito.<HttpClientContext>any())).thenReturn(true);
Mockito.when(keepAliveStrategy.getKeepAliveDuration(
Mockito.same(response),
- Mockito.<HttpClientContext>any())).thenReturn(TimeValue.ofMillis(678L));
+ Mockito.<HttpClientContext>any())).thenReturn(TimeValue.ofMilliseconds(678L));
final ExecChain.Scope scope = new ExecChain.Scope("test", route, request, endpoint, context);
final ClassicHttpResponse finalResponse = mainClientExec.execute(request, scope, null);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java
index 0f29534..6c7dad0 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java
@@ -96,7 +96,7 @@ public class TestBasicHttpClientConnectionManager {
Assert.assertNotNull(endpoint1);
Assert.assertFalse(endpoint1.isConnected());
- mgr.release(endpoint1, null, TimeValue.ofMillis(100));
+ mgr.release(endpoint1, null, TimeValue.ofMilliseconds(100));
Assert.assertNull(mgr.getRoute());
Assert.assertNull(mgr.getState());
@@ -124,7 +124,7 @@ public class TestBasicHttpClientConnectionManager {
Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE);
- mgr.release(endpoint1, null, TimeValue.ofMillis(100));
+ mgr.release(endpoint1, null, TimeValue.ofMilliseconds(100));
Assert.assertEquals(route, mgr.getRoute());
Assert.assertEquals(null, mgr.getState());
@@ -152,7 +152,7 @@ public class TestBasicHttpClientConnectionManager {
Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE);
- mgr.release(endpoint1, "some other state", TimeValue.ofMillis(10000));
+ mgr.release(endpoint1, "some other state", TimeValue.ofMilliseconds(10000));
Assert.assertEquals(route, mgr.getRoute());
Assert.assertEquals("some other state", mgr.getState());
@@ -211,7 +211,7 @@ public class TestBasicHttpClientConnectionManager {
Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE, Boolean.FALSE);
- mgr.release(endpoint1, null, TimeValue.ofMillis(10));
+ mgr.release(endpoint1, null, TimeValue.ofMilliseconds(10));
Assert.assertEquals(route, mgr.getRoute());
Assert.assertEquals(null, mgr.getState());
@@ -289,7 +289,7 @@ public class TestBasicHttpClientConnectionManager {
Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE, Boolean.FALSE);
- mgr.release(endpoint1, null, TimeValue.ofMillis(10));
+ mgr.release(endpoint1, null, TimeValue.ofMilliseconds(10));
Assert.assertEquals(route, mgr.getRoute());
Assert.assertEquals(null, mgr.getState());
@@ -323,7 +323,7 @@ public class TestBasicHttpClientConnectionManager {
Thread.sleep(100);
- mgr.closeIdle(TimeValue.ofMillis(50));
+ mgr.closeIdle(TimeValue.ofMilliseconds(50));
Mockito.verify(conn).close(CloseMode.GRACEFUL);
}
@@ -338,7 +338,7 @@ public class TestBasicHttpClientConnectionManager {
final LeaseRequest connRequest1 = mgr.lease(route, null);
final ConnectionEndpoint endpoint1 = connRequest1.get(Timeout.ZERO_MILLISECONDS);
Assert.assertNotNull(endpoint1);
- mgr.release(endpoint1, null, TimeValue.ofMillis(100));
+ mgr.release(endpoint1, null, TimeValue.ofMilliseconds(100));
mgr.getConnection(route, null);
mgr.getConnection(route, null);
@@ -346,7 +346,7 @@ public class TestBasicHttpClientConnectionManager {
@Test
public void testTargetConnect() throws Exception {
- final HttpHost target = new HttpHost("somehost", 443, "https");
+ final HttpHost target = new HttpHost("https", "somehost", 443);
final InetAddress remote = InetAddress.getByAddress(new byte[] {10, 0, 0, 1});
final InetAddress local = InetAddress.getByAddress(new byte[] {127, 0, 0, 1});
final HttpRoute route = new HttpRoute(target, local, true);
@@ -374,19 +374,19 @@ public class TestBasicHttpClientConnectionManager {
Mockito.<InetSocketAddress>any(),
Mockito.<HttpContext>any())).thenReturn(socket);
- mgr.connect(endpoint1, TimeValue.ofMillis(123), context);
+ mgr.connect(endpoint1, TimeValue.ofMilliseconds(123), context);
Mockito.verify(dnsResolver, Mockito.times(1)).resolve("somehost");
Mockito.verify(schemePortResolver, Mockito.times(1)).resolve(target);
Mockito.verify(plainSocketFactory, Mockito.times(1)).createSocket(context);
- Mockito.verify(plainSocketFactory, Mockito.times(1)).connectSocket(TimeValue.ofMillis(123), socket, target,
+ Mockito.verify(plainSocketFactory, Mockito.times(1)).connectSocket(TimeValue.ofMilliseconds(123), socket, target,
new InetSocketAddress(remote, 8443),
new InetSocketAddress(local, 0), context);
}
@Test
public void testProxyConnectAndUpgrade() throws Exception {
- final HttpHost target = new HttpHost("somehost", 443, "https");
+ final HttpHost target = new HttpHost("https", "somehost", 443);
final HttpHost proxy = new HttpHost("someproxy", 8080);
final InetAddress remote = InetAddress.getByAddress(new byte[] {10, 0, 0, 1});
final InetAddress local = InetAddress.getByAddress(new byte[] {127, 0, 0, 1});
@@ -417,12 +417,12 @@ public class TestBasicHttpClientConnectionManager {
Mockito.<InetSocketAddress>any(),
Mockito.<HttpContext>any())).thenReturn(socket);
- mgr.connect(endpoint1, TimeValue.ofMillis(123), context);
+ mgr.connect(endpoint1, TimeValue.ofMilliseconds(123), context);
Mockito.verify(dnsResolver, Mockito.times(1)).resolve("someproxy");
Mockito.verify(schemePortResolver, Mockito.times(1)).resolve(proxy);
Mockito.verify(plainSocketFactory, Mockito.times(1)).createSocket(context);
- Mockito.verify(plainSocketFactory, Mockito.times(1)).connectSocket(TimeValue.ofMillis(123), socket, proxy,
+ Mockito.verify(plainSocketFactory, Mockito.times(1)).connectSocket(TimeValue.ofMilliseconds(123), socket, proxy,
new InetSocketAddress(remote, 8080),
new InetSocketAddress(local, 0), context);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java
index 70eb81c..87b81d1 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java
@@ -105,7 +105,7 @@ public class TestHttpClientConnectionOperator {
.setSoLinger(50, TimeUnit.MILLISECONDS)
.build();
final InetSocketAddress localAddress = new InetSocketAddress(local, 0);
- connectionOperator.connect(conn, host, localAddress, TimeValue.ofMillis(1000), socketConfig, context);
+ connectionOperator.connect(conn, host, localAddress, TimeValue.ofMilliseconds(1000), socketConfig, context);
Mockito.verify(socket).setKeepAlive(true);
Mockito.verify(socket).setReuseAddress(true);
@@ -114,7 +114,7 @@ public class TestHttpClientConnectionOperator {
Mockito.verify(socket).setTcpNoDelay(true);
Mockito.verify(plainSocketFactory).connectSocket(
- TimeValue.ofMillis(1000),
+ TimeValue.ofMilliseconds(1000),
socket,
host,
new InetSocketAddress(ip1, 80),
@@ -142,7 +142,7 @@ public class TestHttpClientConnectionOperator {
Mockito.<InetSocketAddress>any(),
Mockito.<HttpContext>any())).thenThrow(new SocketTimeoutException());
- connectionOperator.connect(conn, host, null, TimeValue.ofMillis(1000), SocketConfig.DEFAULT, context);
+ connectionOperator.connect(conn, host, null, TimeValue.ofMilliseconds(1000), SocketConfig.DEFAULT, context);
}
@Test(expected=HttpHostConnectException.class)
@@ -164,7 +164,7 @@ public class TestHttpClientConnectionOperator {
Mockito.<InetSocketAddress>any(),
Mockito.<HttpContext>any())).thenThrow(new ConnectException());
- connectionOperator.connect(conn, host, null, TimeValue.ofMillis(1000), SocketConfig.DEFAULT, context);
+ connectionOperator.connect(conn, host, null, TimeValue.ofMilliseconds(1000), SocketConfig.DEFAULT, context);
}
@Test
@@ -195,10 +195,10 @@ public class TestHttpClientConnectionOperator {
Mockito.<HttpContext>any())).thenReturn(socket);
final InetSocketAddress localAddress = new InetSocketAddress(local, 0);
- connectionOperator.connect(conn, host, localAddress, TimeValue.ofMillis(1000), SocketConfig.DEFAULT, context);
+ connectionOperator.connect(conn, host, localAddress, TimeValue.ofMilliseconds(1000), SocketConfig.DEFAULT, context);
Mockito.verify(plainSocketFactory).connectSocket(
- TimeValue.ofMillis(1000),
+ TimeValue.ofMilliseconds(1000),
socket,
host,
new InetSocketAddress(ip2, 80),
@@ -226,10 +226,10 @@ public class TestHttpClientConnectionOperator {
Mockito.<HttpContext>any())).thenReturn(socket);
final InetSocketAddress localAddress = new InetSocketAddress(local, 0);
- connectionOperator.connect(conn, host, localAddress, TimeValue.ofMillis(1000), SocketConfig.DEFAULT, context);
+ connectionOperator.connect(conn, host, localAddress, TimeValue.ofMilliseconds(1000), SocketConfig.DEFAULT, context);
Mockito.verify(plainSocketFactory).connectSocket(
- TimeValue.ofMillis(1000),
+ TimeValue.ofMilliseconds(1000),
socket,
host,
new InetSocketAddress(ip, 80),
@@ -242,7 +242,7 @@ public class TestHttpClientConnectionOperator {
@Test
public void testUpgrade() throws Exception {
final HttpContext context = new BasicHttpContext();
- final HttpHost host = new HttpHost("somehost", -1, "https");
+ final HttpHost host = new HttpHost("https", "somehost", -1);
Mockito.when(conn.isOpen()).thenReturn(true);
Mockito.when(conn.getSocket()).thenReturn(socket);
@@ -263,7 +263,7 @@ public class TestHttpClientConnectionOperator {
@Test(expected=UnsupportedSchemeException.class)
public void testUpgradeUpsupportedScheme() throws Exception {
final HttpContext context = new BasicHttpContext();
- final HttpHost host = new HttpHost("somehost", -1, "httpsssss");
+ final HttpHost host = new HttpHost("httpsssss", "somehost", -1);
Mockito.when(socketFactoryRegistry.lookup("http")).thenReturn(plainSocketFactory);
connectionOperator.upgrade(conn, host, context);
@@ -272,7 +272,7 @@ public class TestHttpClientConnectionOperator {
@Test(expected=UnsupportedSchemeException.class)
public void testUpgradeNonLayeringScheme() throws Exception {
final HttpContext context = new BasicHttpContext();
- final HttpHost host = new HttpHost("somehost", -1, "http");
+ final HttpHost host = new HttpHost("http", "somehost", -1);
Mockito.when(socketFactoryRegistry.lookup("http")).thenReturn(plainSocketFactory);
connectionOperator.upgrade(conn, host, context);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
index fd3bfed..e322cff 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
@@ -256,7 +256,7 @@ public class TestPoolingHttpClientConnectionManager {
@Test
public void testTargetConnect() throws Exception {
- final HttpHost target = new HttpHost("somehost", 443, "https");
+ final HttpHost target = new HttpHost("https", "somehost", 443);
final InetAddress remote = InetAddress.getByAddress(new byte[] {10, 0, 0, 1});
final InetAddress local = InetAddress.getByAddress(new byte[]{127, 0, 0, 1});
final HttpRoute route = new HttpRoute(target, local, true);
@@ -296,19 +296,19 @@ public class TestPoolingHttpClientConnectionManager {
Mockito.<InetSocketAddress>any(),
Mockito.<HttpContext>any())).thenReturn(socket);
- mgr.connect(endpoint1, TimeValue.ofMillis(123), context);
+ mgr.connect(endpoint1, TimeValue.ofMilliseconds(123), context);
Mockito.verify(dnsResolver, Mockito.times(1)).resolve("somehost");
Mockito.verify(schemePortResolver, Mockito.times(1)).resolve(target);
Mockito.verify(plainSocketFactory, Mockito.times(1)).createSocket(context);
- Mockito.verify(plainSocketFactory, Mockito.times(1)).connectSocket(TimeValue.ofMillis(123), socket, target,
+ Mockito.verify(plainSocketFactory, Mockito.times(1)).connectSocket(TimeValue.ofMilliseconds(123), socket, target,
new InetSocketAddress(remote, 8443),
new InetSocketAddress(local, 0), context);
}
@Test
public void testProxyConnectAndUpgrade() throws Exception {
- final HttpHost target = new HttpHost("somehost", 443, "https");
+ final HttpHost target = new HttpHost("https", "somehost", 443);
final HttpHost proxy = new HttpHost("someproxy", 8080);
final InetAddress remote = InetAddress.getByAddress(new byte[] {10, 0, 0, 1});
final InetAddress local = InetAddress.getByAddress(new byte[] {127, 0, 0, 1});
@@ -354,12 +354,12 @@ public class TestPoolingHttpClientConnectionManager {
Mockito.<InetSocketAddress>any(),
Mockito.<HttpContext>any())).thenReturn(mockSock);
- mgr.connect(endpoint1, TimeValue.ofMillis(123), context);
+ mgr.connect(endpoint1, TimeValue.ofMilliseconds(123), context);
Mockito.verify(dnsResolver, Mockito.times(1)).resolve("someproxy");
Mockito.verify(schemePortResolver, Mockito.times(1)).resolve(proxy);
Mockito.verify(plainsf, Mockito.times(1)).createSocket(context);
- Mockito.verify(plainsf, Mockito.times(1)).connectSocket(TimeValue.ofMillis(123), mockSock, proxy,
+ Mockito.verify(plainsf, Mockito.times(1)).connectSocket(TimeValue.ofMilliseconds(123), mockSock, proxy,
new InetSocketAddress(remote, 8080),
new InetSocketAddress(local, 0), context);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultProxyRoutePlanner.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultProxyRoutePlanner.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultProxyRoutePlanner.java
index 164440e..1340dc2 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultProxyRoutePlanner.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultProxyRoutePlanner.java
@@ -60,7 +60,7 @@ public class TestDefaultProxyRoutePlanner {
@Test
public void testDefaultProxyDirect() throws Exception {
- final HttpHost target = new HttpHost("somehost", 80, "http");
+ final HttpHost target = new HttpHost("http", "somehost", 80);
final HttpContext context = new BasicHttpContext();
final HttpRoute route = routePlanner.determineRoute(target, context);
@@ -73,7 +73,7 @@ public class TestDefaultProxyRoutePlanner {
@Test
public void testViaProxy() throws Exception {
- final HttpHost target = new HttpHost("somehost", 80, "http");
+ final HttpHost target = new HttpHost("http", "somehost", 80);
final HttpHost proxy = new HttpHost("custom.proxy.host", 8080);
final HttpRequest request = new BasicHttpRequest("GET", "/");
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultRoutePlanner.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultRoutePlanner.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultRoutePlanner.java
index 6ec2e1f..c6e9cb7 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultRoutePlanner.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultRoutePlanner.java
@@ -57,7 +57,7 @@ public class TestDefaultRoutePlanner {
@Test
public void testDirect() throws Exception {
- final HttpHost target = new HttpHost("somehost", 80, "http");
+ final HttpHost target = new HttpHost("http", "somehost", 80);
final HttpContext context = new BasicHttpContext();
final HttpRoute route = routePlanner.determineRoute(target, context);
@@ -70,20 +70,20 @@ public class TestDefaultRoutePlanner {
@Test
public void testDirectDefaultPort() throws Exception {
- final HttpHost target = new HttpHost("somehost", -1, "https");
+ final HttpHost target = new HttpHost("https", "somehost", -1);
Mockito.when(schemePortResolver.resolve(target)).thenReturn(443);
final HttpContext context = new BasicHttpContext();
final HttpRoute route = routePlanner.determineRoute(target, context);
- Assert.assertEquals(new HttpHost("somehost", 443, "https"), route.getTargetHost());
+ Assert.assertEquals(new HttpHost("https", "somehost", 443), route.getTargetHost());
Assert.assertEquals(1, route.getHopCount());
Assert.assertTrue(route.isSecure());
}
@Test
public void testViaProxy() throws Exception {
- final HttpHost target = new HttpHost("somehost", 80, "http");
+ final HttpHost target = new HttpHost("http", "somehost", 80);
final HttpHost proxy = new HttpHost("proxy", 8080);
final HttpClientContext context = HttpClientContext.create();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRoutingSupport.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRoutingSupport.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRoutingSupport.java
index 57b4f51..b359e0d 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRoutingSupport.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRoutingSupport.java
@@ -49,7 +49,7 @@ public class TestRoutingSupport {
final HttpRequest request2 = new BasicHttpRequest("GET", new URI("https://somehost:8443/"));
final HttpHost host2 = RoutingSupport.determineHost(request2);
- Assert.assertThat(host2, CoreMatchers.equalTo(new HttpHost("somehost", 8443, "https")));
+ Assert.assertThat(host2, CoreMatchers.equalTo(new HttpHost("https", "somehost", 8443)));
}
@Test(expected = ProtocolException.class)
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestSystemDefaultRoutePlanner.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestSystemDefaultRoutePlanner.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestSystemDefaultRoutePlanner.java
index b9fef7e..547bec0 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestSystemDefaultRoutePlanner.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestSystemDefaultRoutePlanner.java
@@ -65,7 +65,7 @@ public class TestSystemDefaultRoutePlanner {
@Test
public void testDirect() throws Exception {
- final HttpHost target = new HttpHost("somehost", 80, "http");
+ final HttpHost target = new HttpHost("http", "somehost", 80);
final HttpContext context = new BasicHttpContext();
final HttpRoute route = routePlanner.determineRoute(target, context);
@@ -78,13 +78,13 @@ public class TestSystemDefaultRoutePlanner {
@Test
public void testDirectDefaultPort() throws Exception {
- final HttpHost target = new HttpHost("somehost", -1, "https");
+ final HttpHost target = new HttpHost("https", "somehost", -1);
Mockito.when(schemePortResolver.resolve(target)).thenReturn(443);
final HttpContext context = new BasicHttpContext();
final HttpRoute route = routePlanner.determineRoute(target, context);
- Assert.assertEquals(new HttpHost("somehost", 443, "https"), route.getTargetHost());
+ Assert.assertEquals(new HttpHost("https", "somehost", 443), route.getTargetHost());
Assert.assertEquals(1, route.getHopCount());
Assert.assertTrue(route.isSecure());
}
@@ -104,7 +104,7 @@ public class TestSystemDefaultRoutePlanner {
Mockito.when(proxySelector.select(new URI("http://somehost:80"))).thenReturn(proxies);
- final HttpHost target = new HttpHost("somehost", 80, "http");
+ final HttpHost target = new HttpHost("http", "somehost", 80);
final HttpContext context = new BasicHttpContext();
final HttpRoute route = routePlanner.determineRoute(target, context);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAddCookies.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAddCookies.java b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAddCookies.java
index 160a264..3671814 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAddCookies.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAddCookies.java
@@ -291,10 +291,10 @@ public class TestRequestAddCookies {
public void testAuthDefaultHttpsPortWhenProxy() throws Exception {
final HttpRequest request = new BasicHttpRequest("GET", "/stuff");
- this.target = new HttpHost("localhost", -1, "https");
+ this.target = new HttpHost("https", "localhost", -1);
final HttpRoute route = new HttpRoute(
- new HttpHost("localhost", 443, "https"), null,
- new HttpHost("localhost", 8888), true, TunnelType.TUNNELLED, LayerType.LAYERED);
+ new HttpHost("https", "localhost", 443), null,
+ new HttpHost("http", "localhost", 8888), true, TunnelType.TUNNELLED, LayerType.LAYERED);
final HttpClientContext context = HttpClientContext.create();
context.setAttribute(HttpClientContext.HTTP_ROUTE, route);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestClientConnControl.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestClientConnControl.java b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestClientConnControl.java
index 0411c77..b4ce09a 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestClientConnControl.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestClientConnControl.java
@@ -67,7 +67,7 @@ public class TestRequestClientConnControl {
final HttpRequest request = new BasicHttpRequest("GET", "/");
final HttpClientContext context = HttpClientContext.create();
- final HttpHost target = new HttpHost("localhost", 80, "http");
+ final HttpHost target = new HttpHost("http", "localhost", 80);
final HttpRoute route = new HttpRoute(target, null, false);
context.setAttribute(HttpClientContext.HTTP_ROUTE, route);
@@ -87,7 +87,7 @@ public class TestRequestClientConnControl {
final HttpRequest request = new BasicHttpRequest("GET", "/");
final HttpClientContext context = HttpClientContext.create();
- final HttpHost target = new HttpHost("localhost", 443, "https");
+ final HttpHost target = new HttpHost("https", "localhost", 443);
final HttpHost proxy = new HttpHost("localhost", 8080);
final HttpRoute route = new HttpRoute(target, null, proxy, true,
TunnelType.TUNNELLED, LayerType.LAYERED);
@@ -109,7 +109,7 @@ public class TestRequestClientConnControl {
final HttpRequest request = new BasicHttpRequest("GET", "/");
final HttpClientContext context = HttpClientContext.create();
- final HttpHost target = new HttpHost("localhost", 80, "http");
+ final HttpHost target = new HttpHost("http", "localhost", 80);
final HttpHost proxy = new HttpHost("localhost", 8080);
final HttpRoute route = new HttpRoute(target, null, proxy, false,
TunnelType.PLAIN, LayerType.PLAIN);
@@ -132,7 +132,7 @@ public class TestRequestClientConnControl {
request.addHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
final HttpClientContext context = HttpClientContext.create();
- final HttpHost target = new HttpHost("localhost", 443, "https");
+ final HttpHost target = new HttpHost("https", "localhost", 443);
final HttpHost proxy = new HttpHost("localhost", 8080);
final HttpRoute route = new HttpRoute(target, null, proxy, true,
TunnelType.TUNNELLED, LayerType.LAYERED);
@@ -155,7 +155,7 @@ public class TestRequestClientConnControl {
request.addHeader("Proxy-Connection", HeaderElements.CLOSE);
final HttpClientContext context = HttpClientContext.create();
- final HttpHost target = new HttpHost("localhost", 80, "http");
+ final HttpHost target = new HttpHost("http", "localhost", 80);
final HttpHost proxy = new HttpHost("localhost", 8080);
final HttpRoute route = new HttpRoute(target, null, proxy, false,
TunnelType.PLAIN, LayerType.PLAIN);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java b/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java
index ec7daa4..8321012 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java
@@ -96,7 +96,7 @@ public class TestURIUtils {
@Test
public void testRewriteScheme() throws Exception {
- final HttpHost target = new HttpHost("thathost", -1, "file"); // scheme should be copied
+ final HttpHost target = new HttpHost("file", "thathost", -1); // scheme should be copied
Assert.assertEquals("file://thathost/stuff", URIUtils.rewriteURI(
URI.create("http://thishost:80/stuff#crap"), target, true).toString());
}
@@ -240,7 +240,7 @@ public class TestURIUtils {
@Test
public void testHttpLocationWithRelativeFragment() throws Exception {
- final HttpHost target = new HttpHost("localhost", -1, "http");
+ final HttpHost target = new HttpHost("http", "localhost", -1);
final URI requestURI = new URI("/stuff#blahblah");
final URI location = URIUtils.resolve(requestURI, target, null);
@@ -253,7 +253,7 @@ public class TestURIUtils {
@Test
public void testHttpLocationWithAbsoluteFragment() throws Exception {
- final HttpHost target = new HttpHost("localhost", 80, "http");
+ final HttpHost target = new HttpHost("http", "localhost", 80);
final URI requestURI = new URIBuilder()
.setHost(target.getHostName())
@@ -269,7 +269,7 @@ public class TestURIUtils {
@Test
public void testHttpLocationRedirect() throws Exception {
- final HttpHost target = new HttpHost("localhost", -1, "http");
+ final HttpHost target = new HttpHost("http", "localhost", -1);
final URI requestURI = new URI("/People.htm#tim");
final URI redirect = new URI("http://localhost/people.html");
@@ -286,7 +286,7 @@ public class TestURIUtils {
@Test
public void testHttpLocationWithRedirectFragment() throws Exception {
- final HttpHost target = new HttpHost("localhost", -1, "http");
+ final HttpHost target = new HttpHost("http", "localhost", -1);
final URI requestURI = new URI("/~tim");
final URI redirect1 = new URI("http://localhost/People.htm#tim");
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7b9f148..e0a47d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,7 @@
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
- <httpcore.version>5.0-beta5</httpcore.version>
+ <httpcore.version>5.0-beta6</httpcore.version>
<log4j.version>2.9.1</log4j.version>
<commons-codec.version>1.11</commons-codec.version>
<ehcache.version>3.4.0</ehcache.version>
[3/4] httpcomponents-client git commit: Removed OSGi module
Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.properties
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.properties b/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.properties
deleted file mode 100644
index 888a023..0000000
--- a/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ /dev/null
@@ -1,94 +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.
-#
-
-proxyconfigurator.name = Apache HTTP Components Proxy Configurator
-proxyconfigurator.description = Factory configuration for transparent proxies used by every HTTP Client.
-
-proxyconfig.name = Apache HTTP Components Proxy Configuration
-proxyconfig.description = Proxy configuration for central and transparent proxying of http client connections.
-
-proxy.enabled.name = Enable HTTP Proxy
-proxy.enabled.description = Whether to enable or disable this particular proxy configuration. \
-The default value is false.
-
-proxy.host.name = HTTP Proxy Host
-proxy.host.description = Host name (or IP Address) of the HTTP Proxy. This property is ignored if \
- this proxy configuration is disabled. This property does not have a default value. Enabling \
- this proxy but not setting the HTTP Proxy Host effectively disables this configuration.
-
-proxy.port.name = HTTP Proxy Port
-proxy.port.description = TCP port of the HTTP Proxy. This property is ignored if \
- this proxy configuration is disabled. This property does not have a default value. Enabling \
- this proxy but not setting the HTTP Proxy Port effectively disables this configuration.
-
-proxy.user.name = HTTP Proxy User
-proxy.user.description = The name of the user to authenticate as with the HTTP \
- Proxy Host. If this field is empty, the proxy is considered to not be \
- authenticated. The default is empty. This property is ignored if proxying is \
- disabled or the proxy host is not properly configured.
-
-proxy.password.name = HTTP Proxy Password
-proxy.password.description = The password of the HTTP Proxy user to authenticate \
- with. The default is empty. This property is ignored if proxying is \
- disabled or the proxy host is not properly configured.
-
-proxy.ntlm.host.name = HTTP Proxy NTLM Host
-proxy.ntlm.host.description = The host the authentication request is \
- originating from. Essentially, the computer name for this machine. By default \
- the credentials assume simple username password authentication. If the proxy \
- happens to be a Microsoft IIS Server using NTLM authentication this property \
- must be set to the NT Domain name of the user to authenticate as. This is \
- not set by default.
-
-proxy.ntlm.domain.name = HTTP Proxy NTLM Domain
-proxy.ntlm.domain.description = The NTLM domain to authenticate within. By \
- default the credentials assume simple username password authentication. If \
- the proxy happens to be a Microsoft IIS Server using NTLM authentication this \
- property must be set to the NT Domain name of the user to authenticate as. \
- This is not set by default.
-
-proxy.exceptions.name = No Proxy For
-proxy.exceptions.description = Lists domain names, host names, IP Addresses or \
- or network addresses for which this proxy configuration should not be used. A domain \
- name indicating all hosts of a domain is indicated by a leading dot, e.g. \
- ".day.com". A network address is indicated with subnet mask notation indicating \
- the number of bits make up the network address, e.g 192.168.1.0/24 means the \
- class C network "192.168.1". Note that for proxy selection, the host name of \
- URL is not resolved but directly compared to the list of exceptions. For this \
- reason you might want to indicate both the network address and the domain for \
- targets which should not be passed through the proxy. This property has no \
- effect if this proxy configuration is disabled. The default value is [ localhost, \
- 127.0.0.1 ].
-
-trustedhosts.name = Apache HTTP Client Trusted Hosts Configuration
-trustedhosts.description = SSL configuration for trusted SSL connections with server self-signed certificates.
-
-trustedhosts.enabled.name = SSL configuration enabled
-trustedhosts.enabled.description = Mark this SSL configuration be taken in consideration \
- when creating a new HTTP CLient instance.
-
-trustedhosts.trustAll.name = Trust all SSL certificates
-trustedhosts.trustAll.description = Allows the new HTTP Client instance to \
- blindly trust all SSL certificates.\
- Pay attention on no enabling this feature in production environment as it is totally insecure!
-
-trustedhosts.hosts.name = Trust SSL self-signed certificates only for specified hosts
-trustedhosts.hosts.description = Allows the new HTTP Client instance to \
- trust all SSL self-signed certificates coming only from the specified hosts. \
- The default value is [ localhost, 127.0.0.1 ].
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.xml
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.xml b/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.xml
deleted file mode 100644
index 8f481ed..0000000
--- a/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ====================================================================
- 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 />.
- -->
-<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0" localization="metatype">
-
- <OCD id="org.apache.hc.client5.http.proxyconfigurator"
- name="%proxyconfig.name"
- description="%proxyconfig.description">
-
- <AD id="proxy.enabled"
- type="Boolean"
- default="false"
- name="%proxy.enabled.name"
- description="%proxy.enabled.description" />
-
- <AD id="proxy.host"
- type="String"
- default=""
- name="%proxy.host.name"
- description="%proxy.host.description" />
-
- <AD id="proxy.port"
- type="Integer"
- default="8080"
- name="%proxy.port.name"
- description="%proxy.port.description" />
-
- <AD id="proxy.user"
- type="String"
- default=""
- name="%proxy.user.name"
- description="%proxy.user.description" />
-
- <AD id="proxy.password"
- type="String"
- default=""
- name="%proxy.password.name"
- description="%proxy.password.description" />
-
- <AD id="proxy.exceptions"
- type="String"
- default="localhost,127.0.0.1"
- cardinality="2147483647"
- name="%proxy.exceptions.name"
- description="%proxy.exceptions.description" />
-
- <AD id="webconsole.configurationFactory.nameHint"
- type="String"
- default="{proxy.host}:{proxy.port} (enabled = {proxy.enabled})"/>
-
- </OCD>
-
- <OCD id="org.apache.hc.client5.http.trustedhosts"
- name="%trustedhosts.name"
- description="%trustedhosts.description">
-
- <AD id="trustedhosts.enabled"
- type="Boolean"
- default="true"
- name="%trustedhosts.enabled.name"
- description="%trustedhosts.enabled.description" />
-
- <AD id="trustedhosts.trustAll"
- type="Boolean"
- default="false"
- name="%trustedhosts.trustAll.name"
- description="%trustedhosts.trustAll.description" />
-
- <AD id="trustedhosts.hosts"
- type="String"
- default="localhost,127.0.0.1"
- cardinality="2147483647"
- name="%trustedhosts.hosts.name"
- description="%trustedhosts.hosts.description" />
-
- </OCD>
-
- <Designate pid="org.apache.hc.client5.http.proxyconfigurator" factoryPid="org.apache.hc.client5.http.proxyconfigurator">
- <Object ocdref="org.apache.hc.client5.http.proxyconfigurator" />
- </Designate>
- <Designate pid="org.apache.hc.client5.http.trustedhosts">
- <Object ocdref="org.apache.hc.client5.http.trustedhosts" />
- </Designate>
-
-</metatype:MetaData>
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/HostMatcherTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/HostMatcherTest.java b/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/HostMatcherTest.java
deleted file mode 100644
index f5acde9..0000000
--- a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/HostMatcherTest.java
+++ /dev/null
@@ -1,87 +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.client5.http.osgi.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.hc.client5.http.osgi.impl.HostMatcher.DomainNameMatcher;
-import org.apache.hc.client5.http.osgi.impl.HostMatcher.HostMatcherFactory;
-import org.apache.hc.client5.http.osgi.impl.HostMatcher.HostNameMatcher;
-import org.apache.hc.client5.http.osgi.impl.HostMatcher.IPAddressMatcher;
-import org.apache.hc.client5.http.osgi.impl.HostMatcher.NetworkAddress;
-import org.junit.Test;
-
-public final class HostMatcherTest {
-
- @Test
- public void testNetworkAddress() {
- final NetworkAddress nullNetworkAddress = NetworkAddress.parse("www.apache.org");
- assertNull(nullNetworkAddress);
-
- final NetworkAddress na = NetworkAddress.parse("127.0.0.1");
- assertEquals(2130706433, na.address);
- assertEquals(-2147483648, na.mask);
- }
-
- @Test
- public void testIPAddressMatcher() {
- final NetworkAddress na = NetworkAddress.parse("127.0.0.1");
- final IPAddressMatcher ipam = new IPAddressMatcher(na);
- assertFalse(ipam.matches("127.0.0.255"));
- }
-
- @Test
- public void testDomainNameMatcher() {
- final DomainNameMatcher dnm = new DomainNameMatcher(".apache.org");
- assertTrue(dnm.matches("www.apache.org"));
- assertTrue(dnm.matches("hc.apache.org"));
- assertTrue(dnm.matches("commons.apache.org"));
- assertTrue(dnm.matches("cocoon.apache.org"));
- assertFalse(dnm.matches("www.gnu.org"));
- }
-
- @Test
- public void testHostNameMatcher() {
- final HostNameMatcher hnm = new HostNameMatcher("www.apache.org");
- assertTrue(hnm.matches("www.apache.org"));
- assertTrue(hnm.matches("WwW.APACHE.org"));
- assertTrue(hnm.matches("wWw.apache.ORG"));
- assertTrue(hnm.matches("WWW.APACHE.ORG"));
- assertFalse(hnm.matches("www.gnu.org"));
- }
-
- @Test
- public void testHostMatcherFactory() {
- assertTrue(HostMatcherFactory.createMatcher("127.0.0.1") instanceof IPAddressMatcher);
- assertTrue(HostMatcherFactory.createMatcher(".apache.org") instanceof DomainNameMatcher);
- assertTrue(HostMatcherFactory.createMatcher("www.apache.org") instanceof HostNameMatcher);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/OSGiCredentialsProviderTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/OSGiCredentialsProviderTest.java b/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/OSGiCredentialsProviderTest.java
deleted file mode 100644
index 43b7e0a..0000000
--- a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/OSGiCredentialsProviderTest.java
+++ /dev/null
@@ -1,105 +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.client5.http.osgi.impl;
-
-import static java.util.Arrays.asList;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertThat;
-
-import java.util.Hashtable;
-
-import org.apache.hc.client5.http.auth.AuthScope;
-import org.apache.hc.client5.http.auth.Credentials;
-import org.apache.hc.client5.http.auth.CredentialsProvider;
-import org.apache.hc.client5.http.auth.NTCredentials;
-import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
-import org.apache.hc.client5.http.osgi.services.ProxyConfiguration;
-import org.apache.hc.core5.http.protocol.BasicHttpContext;
-import org.apache.hc.core5.http.protocol.HttpContext;
-import org.junit.Test;
-
-public class OSGiCredentialsProviderTest {
-
- private static final String HOST = "proxy.example.org";
-
- private static final int PORT = 8080;
-
- private static final HttpContext HTTP_CONTEXT = new BasicHttpContext();
-
- @Test
- public void basicAuthentication() {
- final CredentialsProvider provider = credentialsProvider(proxy("user", "secret"));
- final Credentials credentials = provider.getCredentials(new AuthScope("http", HOST, PORT, null, "BASIC"), HTTP_CONTEXT);
- assertThat(credentials, instanceOf(UsernamePasswordCredentials.class));
- assertCredentials((UsernamePasswordCredentials) credentials, "user", "secret");
- }
-
- @Test
- public void ntlmAuthenticationWithoutDomain() {
- final CredentialsProvider provider = credentialsProvider(proxy("user", "secret"));
- final Credentials credentials = provider.getCredentials(new AuthScope("http", HOST, PORT, null, "NTLM"), HTTP_CONTEXT);
- assertThat(credentials, instanceOf(NTCredentials.class));
- assertCredentials((NTCredentials) credentials, "user", "secret", null);
- }
-
- @Test
- public void ntlmAuthenticationWithDomain() {
- final CredentialsProvider provider = credentialsProvider(proxy("DOMAIN\\user", "secret"));
- final Credentials credentials = provider.getCredentials(new AuthScope("http", HOST, PORT, null, "NTLM"), HTTP_CONTEXT);
- assertThat(credentials, instanceOf(NTCredentials.class));
- assertCredentials((NTCredentials) credentials, "user", "secret", "DOMAIN");
- }
-
- private CredentialsProvider credentialsProvider(final ProxyConfiguration... proxies) {
- return new OSGiCredentialsProvider(asList(proxies));
- }
-
- private void assertCredentials(final UsernamePasswordCredentials credentials, final String user, final String password) {
- assertThat("Username mismatch", credentials.getUserName(), equalTo(user));
- assertThat("Password mismatch", credentials.getPassword(), equalTo(password.toCharArray()));
- }
-
- private void assertCredentials(final NTCredentials credentials, final String user, final String password, final String domain) {
- assertThat("Username mismatch", credentials.getUserName(), equalTo(user));
- assertThat("Password mismatch", credentials.getPassword(), equalTo(password.toCharArray()));
- assertThat("Domain mismatch", credentials.getDomain(), equalTo(domain));
- }
-
- private ProxyConfiguration proxy(final String username, final String password) {
- final OSGiProxyConfiguration proxyConfiguration = new OSGiProxyConfiguration();
- final Hashtable<String, Object> config = new Hashtable<>();
- config.put("proxy.enabled", true);
- config.put("proxy.host", HOST);
- config.put("proxy.port", PORT);
- config.put("proxy.user", username);
- config.put("proxy.password", password);
- config.put("proxy.exceptions", new String[0]);
- proxyConfiguration.update(config);
- return proxyConfiguration;
- }
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/OSGiProxyConfigurationTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/OSGiProxyConfigurationTest.java b/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/OSGiProxyConfigurationTest.java
deleted file mode 100644
index 7d99ff4..0000000
--- a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/OSGiProxyConfigurationTest.java
+++ /dev/null
@@ -1,61 +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.client5.http.osgi.impl;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.junit.Test;
-
-public class OSGiProxyConfigurationTest {
-
- @Test
- public void testToString() {
-
- final Dictionary<String, Object> config = new Hashtable<>();
- config.put("proxy.enabled", false);
- config.put("proxy.host", "h");
- config.put("proxy.port", 1);
- config.put("proxy.user", "u");
- config.put("proxy.password", "p");
- config.put("proxy.exceptions", new String[]{"e"});
-
- final OSGiProxyConfiguration configuration = new OSGiProxyConfiguration();
- configuration.update(config);
-
- final String string = configuration.toString();
- assertThat(string, containsString("enabled=false"));
- assertThat(string, containsString("hostname=h"));
- assertThat(string, containsString("port=1"));
- assertThat(string, containsString("username=u"));
- assertThat(string, containsString("password=p"));
- assertThat(string, containsString("proxyExceptions=[e]"));
- }
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestOSGiHttpRoutePlanner.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestOSGiHttpRoutePlanner.java b/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestOSGiHttpRoutePlanner.java
deleted file mode 100644
index 57fb99a..0000000
--- a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestOSGiHttpRoutePlanner.java
+++ /dev/null
@@ -1,117 +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.client5.http.osgi.impl;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.singletonList;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.InetAddress;
-import java.util.Hashtable;
-
-import org.apache.hc.client5.http.osgi.services.ProxyConfiguration;
-import org.apache.hc.core5.http.HttpHost;
-import org.junit.Test;
-
-/**
- * @since 4.4.3
- */
-public class TestOSGiHttpRoutePlanner {
-
- private final ProxyConfiguration pc1 = proxy("proxy1", 8080, "localhost", "127.0.0.1", ".apache.org");
- private final ProxyConfiguration pc2 = proxy("proxy2", 9090, "localhost", "127.0.0.1", ".oracle.com", "12.34.34.8");
-
- @Test
- public void testDeterminProxy() throws Exception {
- OSGiHttpRoutePlanner planner = new OSGiHttpRoutePlanner(singletonList(pc1));
-
- HttpHost proxy = planner.determineProxy(new HttpHost("localhost", 8090), null);
- assertNull(proxy);
-
- proxy = planner.determineProxy(new HttpHost("there", 9090), null);
- assertNotNull(proxy);
- assertTrue(proxy.getHostName().equals("proxy1"));
-
- proxy = planner.determineProxy(new HttpHost("10.2.144.23", 4554), null);
- assertNotNull(proxy);
- assertTrue(proxy.getHostName().equals("proxy1"));
-
- final InetAddress addr = InetAddress.getByName("localhost");
- proxy = planner.determineProxy(new HttpHost(addr, 4554), null);
- assertNull(proxy);
-
- proxy = planner.determineProxy(new HttpHost("hc.apache.org", 4554), null);
- assertNull(proxy);
-
-
- // test with more than one registration of proxyConfiguration
- planner = new OSGiHttpRoutePlanner(asList(pc1, pc2));
- proxy = planner.determineProxy(new HttpHost("localhost", 8090), null);
- assertNull(proxy);
-
- proxy = planner.determineProxy(new HttpHost("there", 9090), null);
- assertNotNull(proxy);
- assertTrue(proxy.getHostName().equals("proxy1")); // the first one
-
- proxy = planner.determineProxy(new HttpHost(addr, 4554), null);
- assertNull(proxy);
-
- proxy = planner.determineProxy(new HttpHost("hc.apache.org", 4554), null);
- assertNull(proxy);
-
- proxy = planner.determineProxy(new HttpHost("docs.oracle.com", 4554), null);
- assertNull(proxy);
- }
-
- @Test
- public void testMasking() throws Exception {
- final OSGiHttpRoutePlanner planner = new OSGiHttpRoutePlanner(singletonList(pc2));
-
- HttpHost proxy = planner.determineProxy(new HttpHost("12.34.34.2", 4554), null);
- assertNotNull(proxy);
- assertTrue(proxy.getHostName().equals("proxy2"));
-
- proxy = planner.determineProxy(new HttpHost("12.34.34.8", 4554), null);
- assertNotNull(proxy);
- }
-
- private ProxyConfiguration proxy(final String host, final int port, final String... exceptions) {
- final OSGiProxyConfiguration proxyConfiguration = new OSGiProxyConfiguration();
- final Hashtable<String, Object> config = new Hashtable<>();
- config.put("proxy.enabled", true);
- config.put("proxy.host", host);
- config.put("proxy.port", port);
- config.put("proxy.user", "");
- config.put("proxy.password", "");
- config.put("proxy.exceptions", exceptions);
- proxyConfiguration.update(config);
- return proxyConfiguration;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestOSGiTrustedHostsConfiguration.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestOSGiTrustedHostsConfiguration.java b/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestOSGiTrustedHostsConfiguration.java
deleted file mode 100644
index 73d7cbc..0000000
--- a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestOSGiTrustedHostsConfiguration.java
+++ /dev/null
@@ -1,73 +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.client5.http.osgi.impl;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.hc.client5.http.osgi.services.TrustedHostsConfiguration;
-import org.junit.Test;
-import org.osgi.service.cm.ConfigurationException;
-
-public final class TestOSGiTrustedHostsConfiguration {
-
- @Test
- public void testSetValues() throws ConfigurationException {
- final TrustedHostsConfiguration configuration = getTrustedHostsConfiguration();
-
- assertEquals(true, configuration.isEnabled());
- assertEquals(false, configuration.trustAll());
- assertArrayEquals(new String[]{ "localhost" }, configuration.getTrustedHosts());
- }
-
- @Test
- public void testToString() throws ConfigurationException {
- final TrustedHostsConfiguration configuration = getTrustedHostsConfiguration();
-
- final String string = configuration.toString();
- assertThat(string, containsString("enabled=true"));
- assertThat(string, containsString("trustAll=false"));
- assertThat(string, containsString("trustedHosts=[localhost]"));
- }
-
- private TrustedHostsConfiguration getTrustedHostsConfiguration() throws ConfigurationException {
- final Dictionary<String, Object> config = new Hashtable<>();
- config.put("trustedhosts.enabled", true);
- config.put("trustedhosts.trustAll", false);
- config.put("trustedhosts.hosts", new String[]{ "localhost" });
-
- final OSGiTrustedHostsConfiguration configuration = new OSGiTrustedHostsConfiguration();
- configuration.updated(config);
- return configuration;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestPropertiesUtils.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestPropertiesUtils.java b/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestPropertiesUtils.java
deleted file mode 100644
index a64218b..0000000
--- a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestPropertiesUtils.java
+++ /dev/null
@@ -1,132 +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.client5.http.osgi.impl;
-
-import static org.apache.hc.client5.http.osgi.impl.PropertiesUtils.to;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * @since 4.3
- */
-@SuppressWarnings("boxing") // test code
-public final class TestPropertiesUtils {
-
- @Test
- public void toBoolean() {
- assertConverted(true, null, boolean.class, true);
- assertConverted(true, null, Boolean.class, true);
- assertConverted(false, "false", boolean.class, null);
- assertConverted(false, "false", Boolean.class, null);
- // whatever value is interpreted as `false` by Boolean.valueOf
- assertConverted(false, "not a boolean", boolean.class, true);
- assertConverted(false, "not a boolean", Boolean.class, true);
- }
-
- @Test
- public void toSingleString() {
- assertConverted("fallback to default value", null, String.class, "fallback to default value");
- // use an object which represents the string
- assertConverted("use the passed value", new StringBuilder("use the passed value"), String.class, null);
- // use the "identity" converter
- assertConverted("use the passed value", "use the passed value", String.class, null);
- // convert another object
- assertConverted("456789", 456789, String.class, null);
- }
-
- @Test
- public void toStringArray() {
- assertConvertedArray(new String[]{"fallback to default value"},
- null,
- String[].class,
- new String[]{"fallback to default value"});
- // a string is converted to an array with 1 element
- assertConvertedArray(new String[]{"a single string"},
- "a single string",
- String[].class,
- null);
- // use an object which represents the string
- assertConvertedArray(new String[]{"null objects", "will be ignored"},
- new Object[]{new StringBuilder("null objects"), null, new StringBuilder("will be ignored")},
- String[].class,
- null);
- // use the "identity" converter
- assertConvertedArray(new String[]{"null objects", "will be ignored"},
- new Object[]{"null objects", null, "will be ignored"},
- String[].class,
- null);
- assertConvertedArray(new String[]{"fallback to default value"},
- 456789,
- String[].class,
- new String[]{"fallback to default value"});
- }
-
- @Test
- public void toInt() {
- assertConverted(123, null, int.class, 123);
- assertConverted(123, null, Integer.class, 123);
- assertConverted(456, "456", int.class, null);
- assertConverted(456, "456", Integer.class, null);
- assertConverted(789, "not an integer", int.class, 789);
- assertConverted(789, "not an integer", Integer.class, 789);
- }
-
- @Test
- public void toLong() {
- assertConverted(123l, null, long.class, 123l);
- assertConverted(123l, null, Long.class, 123l);
- assertConverted(456l, "456", long.class, null);
- assertConverted(456l, "456", Long.class, null);
- assertConverted(789l, "not a long", long.class, 789l);
- assertConverted(789l, "not a long", Long.class, 789l);
- }
-
- @Test
- public void toDouble() {
- assertConverted(123d, null, double.class, 123d);
- assertConverted(123d, null, Double.class, 123d);
- assertConverted(456d, "456", double.class, null);
- assertConverted(456d, "456", Double.class, null);
- assertConverted(789d, "not a double", double.class, 789d);
- assertConverted(789d, "not a double", Double.class, 789d);
- }
-
- private static <T> void assertConverted(
- final T expected, final Object propValue, final Class<T> targetType, final T defaultValue) {
- final T actual = to(propValue, targetType, defaultValue);
- assertEquals(expected, actual);
- }
-
- private static <T> void assertConvertedArray(
- final T[] expected, final Object propValue, final Class<T[]> targetType, final T[] defaultValue) {
- final T[] actual = to(propValue, targetType, defaultValue);
- assertArrayEquals(expected, actual);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestRelaxedLayeredConnectionSocketFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestRelaxedLayeredConnectionSocketFactory.java b/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestRelaxedLayeredConnectionSocketFactory.java
deleted file mode 100644
index 94980ff..0000000
--- a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/TestRelaxedLayeredConnectionSocketFactory.java
+++ /dev/null
@@ -1,127 +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.client5.http.osgi.impl;
-
-import static org.junit.Assert.assertSame;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory;
-import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.protocol.BasicHttpContext;
-import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.util.TimeValue;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.osgi.service.cm.ConfigurationException;
-
-public class TestRelaxedLayeredConnectionSocketFactory {
-
- @Mock
- Socket insecureSocket;
-
- @Mock
- Socket secureSocket;
-
- private final HttpContext context = new BasicHttpContext();
-
- @Test
- public void testTrustedAllConnections() throws Exception {
- final LayeredConnectionSocketFactory socketFactory = getLayeredConnectionSocketFactory(true, true);
- final Socket socket = socketFactory.createSocket(context);
- final Socket secureSocket = socketFactory.createLayeredSocket(socket, "localhost", 9999, context);
- assertSame(this.secureSocket, secureSocket);
- }
-
- @Test
- public void testTrustedConnections() throws Exception {
- final LayeredConnectionSocketFactory socketFactory = getLayeredConnectionSocketFactory(true, false, "localhost");
- final Socket socket = socketFactory.createSocket(context);
- final Socket localSecureSocket = socketFactory.createLayeredSocket(socket, "localhost", 9999, context);
- assertSame(this.insecureSocket, localSecureSocket);
-
- final Socket apacheSecureSocket = socketFactory.createLayeredSocket(socket, "www.apache.org", 9999, context);
- assertSame(this.secureSocket, apacheSecureSocket);
- }
-
- @Test
- public void testNotEabledConfiguration() throws Exception {
- final LayeredConnectionSocketFactory socketFactory = getLayeredConnectionSocketFactory(false, true);
- final Socket socket = socketFactory.createSocket(context);
- final Socket secureSocket = socketFactory.createLayeredSocket(socket, "localhost", 9999, context);
- assertSame(this.secureSocket, secureSocket);
- }
-
- private LayeredConnectionSocketFactory getLayeredConnectionSocketFactory(
- final boolean enabled, final boolean trustAll, final String... trustedHosts) throws ConfigurationException {
- final OSGiTrustedHostsConfiguration configuration = new OSGiTrustedHostsConfiguration();
- configuration.updated(createConfig(enabled, trustAll, trustedHosts));
-
- final LayeredConnectionSocketFactory defaultSocketFactory = new LayeredConnectionSocketFactory() {
-
- @Override
- public Socket createSocket(final HttpContext context) throws IOException {
- return insecureSocket;
- }
-
- @Override
- public Socket connectSocket(final TimeValue connectTimeout,
- final Socket sock,
- final HttpHost host,
- final InetSocketAddress remoteAddress,
- final InetSocketAddress localAddress,
- final HttpContext context ) throws IOException {
- // not needed in this version
- return insecureSocket;
- }
-
- @Override
- public Socket createLayeredSocket(final Socket socket,
- final String target,
- final int port,
- final HttpContext context) throws IOException {
- return secureSocket;
- }
-
- };
-
- return new RelaxedLayeredConnectionSocketFactory(configuration, defaultSocketFactory);
- }
-
- private Dictionary<String, Object> createConfig(final boolean enabled, final boolean trustAll, final String... trustedHosts) {
- final Dictionary<String, Object> config = new Hashtable<>();
- config.put("trustedhosts.enabled", enabled);
- config.put("trustedhosts.trustAll", trustAll);
- config.put("trustedhosts.hosts", trustedHosts);
- return config;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/WeakListTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/WeakListTest.java b/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/WeakListTest.java
deleted file mode 100644
index ff0f9c7..0000000
--- a/httpclient5-osgi/src/test/java/org/apache/hc/client5/http/osgi/impl/WeakListTest.java
+++ /dev/null
@@ -1,73 +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.client5.http.osgi.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import org.junit.Test;
-
-public class WeakListTest {
-
- @Test
- public void testWeakList() {
- final WeakList<Object> list = new WeakList<>();
- list.add("hello");
- list.add(null);
-
- // null objects are seen as GC'd, so we only expect a size of 1
- assertEquals(1, list.size());
-
- final Iterator<Object> it = list.iterator();
- assertTrue(it.hasNext());
- assertEquals("hello", it.next());
- assertFalse(it.hasNext());
- boolean thrown = false;
- try {
- it.next();
- } catch (final NoSuchElementException e) {
- thrown = true;
- }
- assertTrue(thrown);
- }
-
- @Test
- public void clearSupported() {
- final WeakList<Object> list = new WeakList<>();
-
- list.add("hello");
- assertEquals(1, list.size());
-
- list.clear();
- assertEquals(0, list.size());
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/test/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/test/resources/log4j2.xml b/httpclient5-osgi/src/test/resources/log4j2.xml
deleted file mode 100644
index 0c9bfe2..0000000
--- a/httpclient5-osgi/src/test/resources/log4j2.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<Configuration status="WARN" name="XMLConfigTest">
- <Appenders>
- <Console name="STDOUT">
- <PatternLayout pattern="%d %-5level [%t][%logger]%notEmpty{[%markerSimpleName]} %msg%n%xThrowable" />
- </Console>
- </Appenders>
- <Loggers>
- <Root level="WARN">
- <AppenderRef ref="STDOUT" />
- </Root>
- </Loggers>
-</Configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e0a47d1..5e439a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -176,7 +176,6 @@
<module>httpclient5-cache</module>
<module>httpclient5-win</module>
<module>httpclient5-testing</module>
- <module>httpclient5-osgi</module>
</modules>
<build>
[2/4] httpcomponents-client git commit: Upgraded HttpCore to version
5.0-beta6
Posted by ol...@apache.org.
Upgraded HttpCore to version 5.0-beta6
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/b4520067
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/b4520067
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/b4520067
Branch: refs/heads/master
Commit: b4520067565cc5c484ebae126311bbf060eb3527
Parents: 4ee9d31
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Tue Dec 4 15:49:56 2018 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Dec 4 15:49:56 2018 +0100
----------------------------------------------------------------------
.../hc/client5/http/cache/HttpCacheEntry.java | 27 ------------------
.../http/impl/cache/AsyncCachingExec.java | 16 +++++------
.../hc/client5/http/impl/cache/CachingExec.java | 2 +-
.../ExponentialBackOffSchedulingStrategy.java | 2 +-
.../http/impl/cache/TestCacheKeyGenerator.java | 30 ++++++++++----------
...ExponentialBackingOffSchedulingStrategy.java | 16 +++++------
.../client5/testing/async/AsyncEchoHandler.java | 4 +--
.../testing/async/AsyncRandomHandler.java | 3 +-
.../async/AuthenticatingAsyncDecorator.java | 6 ++--
.../async/AbstractHttp1IntegrationTestBase.java | 2 +-
.../async/AbstractHttpAsyncRedirectsTest.java | 22 +++++++-------
.../async/AbstractIntegrationTestBase.java | 4 +--
.../testing/async/TestHttp1AsyncRedirects.java | 2 +-
.../TestHttp1AsyncStatefulConnManagement.java | 2 +-
...CachingHttpAsyncClientCompatibilityTest.java | 4 +--
.../CachingHttpClientCompatibilityTest.java | 2 +-
.../HttpAsyncClientCompatibilityTest.java | 16 +++++------
.../external/HttpClientCompatibilityTest.java | 12 ++++----
.../testing/sync/LocalServerTestBase.java | 2 +-
.../testing/sync/TestConnectionManagement.java | 14 ++++-----
.../sync/TestIdleConnectionEviction.java | 2 +-
.../testing/sync/TestSSLSocketFactory.java | 16 +++++------
.../http/examples/AsyncClientCustomSSL.java | 2 +-
.../examples/AsyncClientFullDuplexExchange.java | 4 +--
.../AsyncClientHttp2FullDuplexExchange.java | 4 +--
.../examples/AsyncClientHttp2ServerPush.java | 10 -------
.../AsyncClientHttpExchangeStreaming.java | 5 ----
.../http/examples/AsyncClientTlsAlpn.java | 2 +-
.../client5/http/examples/AsyncQuickStart.java | 5 ----
.../http/examples/ClientExecuteProxy.java | 4 +--
.../http/examples/ClientExecuteSOCKS.java | 2 +-
.../ClientPreemptiveBasicAuthentication.java | 2 +-
.../ClientPreemptiveDigestAuthentication.java | 2 +-
.../examples/ClientProxyAuthentication.java | 2 +-
.../ReactiveClientFullDuplexExchange.java | 23 ++++++++-------
.../hc/client5/http/impl/AuthSupport.java | 8 +++---
.../impl/async/Http2AsyncMainClientExec.java | 6 ++--
.../impl/async/HttpAsyncMainClientExec.java | 6 ++--
.../LoggingAsyncClientExchangeHandler.java | 4 +--
.../http/impl/async/LoggingIOSession.java | 5 ++++
.../impl/async/MinimalHttp2AsyncClient.java | 6 ++--
.../http/impl/async/MinimalHttpAsyncClient.java | 6 ++--
.../impl/classic/CloseableHttpResponse.java | 27 ------------------
.../client5/http/impl/classic/ProxyClient.java | 2 +-
.../io/DefaultManagedHttpClientConnection.java | 4 +--
.../impl/routing/SystemDefaultRoutePlanner.java | 2 +-
.../client5/http/protocol/RequestAuthCache.java | 4 +--
.../hc/client5/http/routing/RoutingSupport.java | 4 +--
.../apache/hc/client5/http/utils/URIUtils.java | 2 +-
.../hc/client5/http/auth/TestAuthScope.java | 4 +--
.../client5/http/config/TestRequestConfig.java | 4 +--
.../http/impl/TestIdleConnectionEvictor.java | 4 +--
.../impl/classic/TestCloseableHttpClient.java | 16 +++++------
.../impl/classic/TestInternalExecRuntime.java | 10 +++----
.../http/impl/classic/TestMainClientExec.java | 6 ++--
.../TestBasicHttpClientConnectionManager.java | 26 ++++++++---------
.../io/TestHttpClientConnectionOperator.java | 22 +++++++-------
.../TestPoolingHttpClientConnectionManager.java | 12 ++++----
.../routing/TestDefaultProxyRoutePlanner.java | 4 +--
.../impl/routing/TestDefaultRoutePlanner.java | 8 +++---
.../http/impl/routing/TestRoutingSupport.java | 2 +-
.../routing/TestSystemDefaultRoutePlanner.java | 8 +++---
.../http/protocol/TestRequestAddCookies.java | 6 ++--
.../protocol/TestRequestClientConnControl.java | 10 +++----
.../hc/client5/http/utils/TestURIUtils.java | 10 +++----
pom.xml | 2 +-
66 files changed, 218 insertions(+), 295 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HttpCacheEntry.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HttpCacheEntry.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HttpCacheEntry.java
index ae00f77..47ed671 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HttpCacheEntry.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HttpCacheEntry.java
@@ -175,15 +175,6 @@ public class HttpCacheEntry implements MessageHeaders, Serializable {
}
/**
- * @deprecated use {@link #getHeaders()}
- */
- @Override
- @Deprecated
- public Header[] getAllHeaders() {
- return getHeaders();
- }
-
- /**
* Returns the first header from the origin response with the given
* name.
*/
@@ -232,15 +223,6 @@ public class HttpCacheEntry implements MessageHeaders, Serializable {
}
/**
- * @deprecated use {@link #countHeaders(String)}
- */
- @Override
- @Deprecated
- public int containsHeaders(final String name) {
- return countHeaders(name);
- }
-
- /**
* @since 5.0
*/
@Override
@@ -249,15 +231,6 @@ public class HttpCacheEntry implements MessageHeaders, Serializable {
}
/**
- * @deprecated use {@link #getHeader(String)}
- */
- @Override
- @Deprecated
- public Header getSingleHeader(final String name) throws ProtocolException {
- return getHeader(name);
- }
-
- /**
* @since 5.0
*/
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
index beecb4d..2d0b69e 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
@@ -210,7 +210,7 @@ class AsyncCachingExec extends CachingExecBase implements AsyncExecChainHandler
final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme();
- final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();
+ final HttpHost target = authority != null ? new HttpHost(scheme, authority) : route.getTargetHost();
final String via = generateViaHeader(request);
// default response context
@@ -371,7 +371,7 @@ class AsyncCachingExec extends CachingExecBase implements AsyncExecChainHandler
}
@Override
- public final int consume(final ByteBuffer src) throws IOException {
+ public final void consume(final ByteBuffer src) throws IOException {
final ByteArrayBuffer buffer = bufferRef.get();
if (buffer != null) {
if (src.hasArray()) {
@@ -391,19 +391,17 @@ class AsyncCachingExec extends CachingExecBase implements AsyncExecChainHandler
if (dataConsumer != null) {
dataConsumerRef.set(dataConsumer);
writtenThrough.set(true);
- return dataConsumer.consume(ByteBuffer.wrap(buffer.array(), 0, buffer.length()));
+ dataConsumer.consume(ByteBuffer.wrap(buffer.array(), 0, buffer.length()));
}
} catch (final HttpException ex) {
fallback.failed(ex);
}
}
- return Integer.MAX_VALUE;
- }
- final AsyncDataConsumer dataConsumer = dataConsumerRef.get();
- if (dataConsumer != null) {
- return dataConsumer.consume(src);
} else {
- return Integer.MAX_VALUE;
+ final AsyncDataConsumer dataConsumer = dataConsumerRef.get();
+ if (dataConsumer != null) {
+ dataConsumer.consume(src);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
index 10a0f8d..cd5725a 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
@@ -166,7 +166,7 @@ class CachingExec extends CachingExecBase implements ExecChainHandler {
final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme();
- final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();
+ final HttpHost target = authority != null ? new HttpHost(scheme, authority) : route.getTargetHost();
final String via = generateViaHeader(request);
// default response context
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/schedule/ExponentialBackOffSchedulingStrategy.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/schedule/ExponentialBackOffSchedulingStrategy.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/schedule/ExponentialBackOffSchedulingStrategy.java
index 92e5509..b00b188 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/schedule/ExponentialBackOffSchedulingStrategy.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/schedule/ExponentialBackOffSchedulingStrategy.java
@@ -91,7 +91,7 @@ public class ExponentialBackOffSchedulingStrategy implements SchedulingStrategy
@Override
public TimeValue schedule(final int attemptNumber) {
- return TimeValue.ofMillis(calculateDelayInMillis(attemptNumber));
+ return TimeValue.ofMilliseconds(calculateDelayInMillis(attemptNumber));
}
public long getBackOffRate() {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java
index e1b9256..ef409c2 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java
@@ -80,11 +80,11 @@ public class TestCacheKeyGenerator {
@Test
public void testGetURIWithDifferentScheme() {
- Assert.assertEquals("https://www.comcast.net:443/", extractor.generateKey(new HttpHost(
- "www.comcast.net", -1, "https"), REQUEST_ROOT));
+ Assert.assertEquals("https://www.comcast.net:443/", extractor.generateKey(
+ new HttpHost("https", "www.comcast.net", -1), REQUEST_ROOT));
Assert.assertEquals("myhttp://www.fancast.com/full_episodes", extractor.generateKey(
- new HttpHost("www.fancast.com", -1, "myhttp"), REQUEST_FULL_EPISODES));
+ new HttpHost("myhttp", "www.fancast.com", -1), REQUEST_FULL_EPISODES));
}
@Test
@@ -98,19 +98,19 @@ public class TestCacheKeyGenerator {
@Test
public void testGetURIWithDifferentPortAndScheme() {
- Assert.assertEquals("https://www.comcast.net:8080/", extractor.generateKey(new HttpHost(
- "www.comcast.net", 8080, "https"), REQUEST_ROOT));
+ Assert.assertEquals("https://www.comcast.net:8080/", extractor.generateKey(
+ new HttpHost("https", "www.comcast.net", 8080), REQUEST_ROOT));
Assert.assertEquals("myhttp://www.fancast.com:9999/full_episodes", extractor.generateKey(
- new HttpHost("www.fancast.com", 9999, "myhttp"), REQUEST_FULL_EPISODES));
+ new HttpHost("myhttp", "www.fancast.com", 9999), REQUEST_FULL_EPISODES));
}
@Test
public void testGetURIWithQueryParameters() {
- Assert.assertEquals("http://www.comcast.net:80/?foo=bar", extractor.generateKey(new HttpHost(
- "www.comcast.net", -1, "http"), new BasicHttpRequest("GET", "/?foo=bar")));
+ Assert.assertEquals("http://www.comcast.net:80/?foo=bar", extractor.generateKey(
+ new HttpHost("http", "www.comcast.net", -1), new BasicHttpRequest("GET", "/?foo=bar")));
Assert.assertEquals("http://www.fancast.com:80/full_episodes?foo=bar", extractor.generateKey(
- new HttpHost("www.fancast.com", -1, "http"), new BasicHttpRequest("GET",
+ new HttpHost("http", "www.fancast.com", -1), new BasicHttpRequest("GET",
"/full_episodes?foo=bar")));
}
@@ -294,8 +294,8 @@ public class TestCacheKeyGenerator {
@Test
public void testEmptyPortEquivalentToDefaultPortForHttps() {
- final HttpHost host1 = new HttpHost("foo.example.com", -1, "https");
- final HttpHost host2 = new HttpHost("foo.example.com", 443, "https");
+ final HttpHost host1 = new HttpHost("https", "foo.example.com", -1);
+ final HttpHost host2 = new HttpHost("https", "foo.example.com", 443);
final HttpRequest req = new BasicHttpRequest("GET", "/");
final String uri1 = extractor.generateKey(host1, req);
final String uri2 = extractor.generateKey(host2, req);
@@ -304,7 +304,7 @@ public class TestCacheKeyGenerator {
@Test
public void testEmptyPortEquivalentToDefaultPortForHttpsAbsoluteURI() {
- final HttpHost host = new HttpHost("foo.example.com", -1, "https");
+ final HttpHost host = new HttpHost("https", "foo.example.com", -1);
final HttpGet get1 = new HttpGet("https://bar.example.com:/");
final HttpGet get2 = new HttpGet("https://bar.example.com:443/");
final String uri1 = extractor.generateKey(host, get1);
@@ -314,7 +314,7 @@ public class TestCacheKeyGenerator {
@Test
public void testNotProvidedPortEquivalentToDefaultPortForHttpsAbsoluteURI() {
- final HttpHost host = new HttpHost("foo.example.com", -1, "https");
+ final HttpHost host = new HttpHost("https", "foo.example.com", -1);
final HttpGet get1 = new HttpGet("https://bar.example.com/");
final HttpGet get2 = new HttpGet("https://bar.example.com:443/");
final String uri1 = extractor.generateKey(host, get1);
@@ -340,8 +340,8 @@ public class TestCacheKeyGenerator {
@Test
public void testSchemeNameComparisonsAreCaseInsensitive() {
- final HttpHost host1 = new HttpHost("foo.example.com", -1, "http");
- final HttpHost host2 = new HttpHost("foo.example.com", -1, "HTTP");
+ final HttpHost host1 = new HttpHost("http", "foo.example.com", -1);
+ final HttpHost host2 = new HttpHost("HTTP", "foo.example.com", -1);
final HttpRequest req = new BasicHttpRequest("GET", "/");
Assert.assertEquals(extractor.generateKey(host1, req), extractor.generateKey(host2, req));
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java
index 65181c9..83d25b6 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java
@@ -46,14 +46,14 @@ public class TestExponentialBackingOffSchedulingStrategy {
@Test
public void testSchedule() {
- Assert.assertEquals(TimeValue.ofMillis(0), impl.schedule(0));
- Assert.assertEquals(TimeValue.ofMillis(6000), impl.schedule(1));
- Assert.assertEquals(TimeValue.ofMillis(60000), impl.schedule(2));
- Assert.assertEquals(TimeValue.ofMillis(600000), impl.schedule(3));
- Assert.assertEquals(TimeValue.ofMillis(6000000), impl.schedule(4));
- Assert.assertEquals(TimeValue.ofMillis(60000000), impl.schedule(5));
- Assert.assertEquals(TimeValue.ofMillis(86400000), impl.schedule(6));
- Assert.assertEquals(TimeValue.ofMillis(86400000), impl.schedule(Integer.MAX_VALUE));
+ Assert.assertEquals(TimeValue.ofMilliseconds(0), impl.schedule(0));
+ Assert.assertEquals(TimeValue.ofMilliseconds(6000), impl.schedule(1));
+ Assert.assertEquals(TimeValue.ofMilliseconds(60000), impl.schedule(2));
+ Assert.assertEquals(TimeValue.ofMilliseconds(600000), impl.schedule(3));
+ Assert.assertEquals(TimeValue.ofMilliseconds(6000000), impl.schedule(4));
+ Assert.assertEquals(TimeValue.ofMilliseconds(60000000), impl.schedule(5));
+ Assert.assertEquals(TimeValue.ofMilliseconds(86400000), impl.schedule(6));
+ Assert.assertEquals(TimeValue.ofMilliseconds(86400000), impl.schedule(Integer.MAX_VALUE));
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
index 98affe3..b1c58b9 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
@@ -125,8 +125,8 @@ public class AsyncEchoHandler implements AsyncServerExchangeHandler {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return entityConsumer.consume(src);
+ public void consume(final ByteBuffer src) throws IOException {
+ entityConsumer.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
index 3f6d543..fbbe612 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
@@ -123,8 +123,7 @@ public class AsyncRandomHandler implements AsyncServerExchangeHandler {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return Integer.MAX_VALUE;
+ public void consume(final ByteBuffer src) throws IOException {
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
index 2a8b5a4..030bc26 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
@@ -119,12 +119,10 @@ public class AuthenticatingAsyncDecorator implements AsyncServerExchangeHandler
}
@Override
- public final int consume(final ByteBuffer src) throws IOException {
+ public final void consume(final ByteBuffer src) throws IOException {
final AsyncResponseProducer responseProducer = responseProducerRef.get();
if (responseProducer == null) {
- return exchangeHandler.consume(src);
- } else {
- return Integer.MAX_VALUE;
+ exchangeHandler.consume(src);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
index 59b46b8..074f4e3 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
@@ -116,7 +116,7 @@ public abstract class AbstractHttp1IntegrationTestBase extends AbstractServerTes
httpclient.start();
final ListenerEndpoint endpoint = endpointFuture.get();
final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
- return new HttpHost("localhost", address.getPort(), scheme.name());
+ return new HttpHost(scheme.name(), "localhost", address.getPort());
}
public HttpHost start(
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
index e98a140..9ceafa5 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
@@ -249,7 +249,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/newlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -273,7 +273,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/newlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -304,7 +304,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
final HttpRequest request = context.getRequest();
Assert.assertEquals(HttpStatus.SC_MOVED_TEMPORARILY, response.getCode());
Assert.assertEquals("/oldlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -328,7 +328,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/newlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -398,7 +398,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/newlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test(expected=ExecutionException.class)
@@ -503,7 +503,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/relativelocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -529,7 +529,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/test/relativelocation", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
static class BogusRedirectService extends AbstractSimpleServerExchangeHandler {
@@ -707,7 +707,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
final ListenerEndpoint endpoint2 = endpointFuture.get();
final InetSocketAddress address2 = (InetSocketAddress) endpoint2.getAddress();
- final HttpHost initialTarget = new HttpHost("localhost", address2.getPort(), scheme.name());
+ final HttpHost initialTarget = new HttpHost(scheme.name(), "localhost", address2.getPort());
final Queue<Future<SimpleHttpResponse>> queue = new ConcurrentLinkedQueue<>();
for (int i = 0; i < 1; i++) {
@@ -776,7 +776,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
Assert.assertEquals("/rome", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -807,7 +807,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
Assert.assertEquals("/rome", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -839,7 +839,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
Assert.assertEquals("/rome", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
index 808f5db..422837b 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
@@ -82,7 +82,7 @@ public abstract class AbstractIntegrationTestBase<T extends CloseableHttpAsyncCl
httpclient.start();
final ListenerEndpoint endpoint = endpointFuture.get();
final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
- return new HttpHost("localhost", address.getPort(), scheme.name());
+ return new HttpHost(scheme.name(), "localhost", address.getPort());
}
public final HttpHost start(
@@ -101,7 +101,7 @@ public abstract class AbstractIntegrationTestBase<T extends CloseableHttpAsyncCl
httpclient.start();
final ListenerEndpoint endpoint = endpointFuture.get();
final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
- return new HttpHost("localhost", address.getPort(), scheme.name());
+ return new HttpHost(scheme.name(), "localhost", address.getPort());
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java
index 02518f8..75f0a8d 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java
@@ -211,7 +211,7 @@ public class TestHttp1AsyncRedirects extends AbstractHttpAsyncRedirectsTest<Clos
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/newlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
index f58fe60..6411eb7 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
@@ -293,7 +293,7 @@ public class TestHttp1AsyncStatefulConnManagement extends AbstractIntegrationTes
final HttpContext context2 = new BasicHttpContext();
final Future<SimpleHttpResponse> future2 = httpclient.execute(SimpleHttpRequests.GET.create(
- new HttpHost("127.0.0.1", target.getPort(), target.getSchemeName()),"/"), context2, null);
+ new HttpHost(target.getSchemeName(), "127.0.0.1", target.getPort()),"/"), context2, null);
final HttpResponse response2 = future2.get();
Assert.assertNotNull(response2);
Assert.assertEquals(200, response2.getCode());
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpAsyncClientCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpAsyncClientCompatibilityTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpAsyncClientCompatibilityTest.java
index fcffd94..7262f88 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpAsyncClientCompatibilityTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpAsyncClientCompatibilityTest.java
@@ -65,9 +65,9 @@ public class CachingHttpAsyncClientCompatibilityTest {
public static void main(final String... args) throws Exception {
final CachingHttpAsyncClientCompatibilityTest[] tests = new CachingHttpAsyncClientCompatibilityTest[] {
new CachingHttpAsyncClientCompatibilityTest(
- HttpVersion.HTTP_1_1, new HttpHost("localhost", 8080, "http")),
+ HttpVersion.HTTP_1_1, new HttpHost("http", "localhost", 8080)),
new CachingHttpAsyncClientCompatibilityTest(
- HttpVersion.HTTP_2_0, new HttpHost("localhost", 8080, "http"))
+ HttpVersion.HTTP_2_0, new HttpHost("http", "localhost", 8080))
};
for (final CachingHttpAsyncClientCompatibilityTest test: tests) {
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpClientCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpClientCompatibilityTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpClientCompatibilityTest.java
index ee3ba86..6c248b2 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpClientCompatibilityTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpClientCompatibilityTest.java
@@ -60,7 +60,7 @@ public class CachingHttpClientCompatibilityTest {
public static void main(final String... args) throws Exception {
final CachingHttpClientCompatibilityTest[] tests = new CachingHttpClientCompatibilityTest[] {
new CachingHttpClientCompatibilityTest(
- new HttpHost("localhost", 8080, "http"))
+ new HttpHost("http", "localhost", 8080))
};
for (final CachingHttpClientCompatibilityTest test: tests) {
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java
index 3de9866..7132afb 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java
@@ -65,30 +65,30 @@ public class HttpAsyncClientCompatibilityTest {
final HttpAsyncClientCompatibilityTest[] tests = new HttpAsyncClientCompatibilityTest[] {
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("localhost", 8080, "http"), null, null),
+ new HttpHost("http", "localhost", 8080), null, null),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("test-httpd", 8080, "http"), new HttpHost("localhost", 8888), null),
+ new HttpHost("http", "test-httpd", 8080), new HttpHost("localhost", 8888), null),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("test-httpd", 8080, "http"), new HttpHost("localhost", 8889),
+ new HttpHost("http", "test-httpd", 8080), new HttpHost("localhost", 8889),
new UsernamePasswordCredentials("squid", "nopassword".toCharArray())),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("localhost", 8443, "https"), null, null),
+ new HttpHost("https", "localhost", 8443), null, null),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("test-httpd", 8443, "https"), new HttpHost("localhost", 8888), null),
+ new HttpHost("https", "test-httpd", 8443), new HttpHost("localhost", 8888), null),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("test-httpd", 8443, "https"), new HttpHost("localhost", 8889),
+ new HttpHost("https", "test-httpd", 8443), new HttpHost("localhost", 8889),
new UsernamePasswordCredentials("squid", "nopassword".toCharArray())),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_2_0,
- new HttpHost("localhost", 8080, "http"), null, null),
+ new HttpHost("http", "localhost", 8080), null, null),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_2_0,
- new HttpHost("localhost", 8443, "https"), null, null)
+ new HttpHost("https", "localhost", 8443), null, null)
};
for (final HttpAsyncClientCompatibilityTest test: tests) {
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java
index 42cfc60..e1f3f8b 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java
@@ -59,18 +59,18 @@ public class HttpClientCompatibilityTest {
public static void main(final String... args) throws Exception {
final HttpClientCompatibilityTest[] tests = new HttpClientCompatibilityTest[] {
new HttpClientCompatibilityTest(
- new HttpHost("localhost", 8080, "http"), null, null),
+ new HttpHost("http", "localhost", 8080), null, null),
new HttpClientCompatibilityTest(
- new HttpHost("test-httpd", 8080, "http"), new HttpHost("localhost", 8888), null),
+ new HttpHost("http", "test-httpd", 8080), new HttpHost("localhost", 8888), null),
new HttpClientCompatibilityTest(
- new HttpHost("test-httpd", 8080, "http"), new HttpHost("localhost", 8889),
+ new HttpHost("http", "test-httpd", 8080), new HttpHost("localhost", 8889),
new UsernamePasswordCredentials("squid", "nopassword".toCharArray())),
new HttpClientCompatibilityTest(
- new HttpHost("localhost", 8443, "https"), null, null),
+ new HttpHost("https", "localhost", 8443), null, null),
new HttpClientCompatibilityTest(
- new HttpHost("test-httpd", 8443, "https"), new HttpHost("localhost", 8888), null),
+ new HttpHost("https", "test-httpd", 8443), new HttpHost("localhost", 8888), null),
new HttpClientCompatibilityTest(
- new HttpHost("test-httpd", 8443, "https"), new HttpHost("localhost", 8889),
+ new HttpHost("https", "test-httpd", 8443), new HttpHost("localhost", 8889),
new UsernamePasswordCredentials("squid", "nopassword".toCharArray()))
};
for (final HttpClientCompatibilityTest test: tests) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
index 60b7dbe..d0cda8b 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
@@ -134,7 +134,7 @@ public abstract class LocalServerTestBase {
this.httpclient = this.clientBuilder.build();
}
- return new HttpHost("localhost", this.server.getPort(), this.scheme.name());
+ return new HttpHost(this.scheme.name(), "localhost", this.server.getPort());
}
public HttpHost start() throws Exception {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java
index 89267c2..e58cadf 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java
@@ -97,7 +97,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
try {
// this should fail quickly, connection has not been released
final LeaseRequest leaseRequest2 = this.connManager.lease(route, null);
- leaseRequest2.get(Timeout.ofMillis(10));
+ leaseRequest2.get(Timeout.ofMilliseconds(10));
Assert.fail("TimeoutException expected");
} catch (final TimeoutException ex) {
// expected
@@ -165,14 +165,14 @@ public class TestConnectionManagement extends LocalServerTestBase {
try {
// this should fail quickly, connection has not been released
final LeaseRequest leaseRequest2 = this.connManager.lease(route, null);
- leaseRequest2.get(Timeout.ofMillis(10));
+ leaseRequest2.get(Timeout.ofMilliseconds(10));
Assert.fail("TimeoutException expected");
} catch (final TimeoutException ex) {
// expected
}
endpoint1.close();
- this.connManager.release(endpoint1, null, TimeValue.ofMillis(100));
+ this.connManager.release(endpoint1, null, TimeValue.ofMilliseconds(100));
final LeaseRequest leaseRequest2 = this.connManager.lease(route, null);
final ConnectionEndpoint endpoint2 = leaseRequest2.get(Timeout.ZERO_MILLISECONDS);
@@ -184,7 +184,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
}
- this.connManager.release(endpoint2, null, TimeValue.ofMillis(100));
+ this.connManager.release(endpoint2, null, TimeValue.ofMilliseconds(100));
final LeaseRequest leaseRequest3 = this.connManager.lease(route, null);
final ConnectionEndpoint endpoint3 = leaseRequest3.get(Timeout.ZERO_MILLISECONDS);
@@ -195,7 +195,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
Assert.assertEquals(HttpStatus.SC_OK, response3.getCode());
}
- this.connManager.release(endpoint3, null, TimeValue.ofMillis(100));
+ this.connManager.release(endpoint3, null, TimeValue.ofMilliseconds(100));
Thread.sleep(150);
final LeaseRequest leaseRequest4 = this.connManager.lease(route, null);
@@ -228,7 +228,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
Assert.assertEquals(1, this.connManager.getTotalStats().getLeased());
Assert.assertEquals(1, this.connManager.getStats(route).getLeased());
- this.connManager.release(endpoint1, null, TimeValue.ofMillis(100));
+ this.connManager.release(endpoint1, null, TimeValue.ofMilliseconds(100));
// Released, still active.
Assert.assertEquals(1, this.connManager.getTotalStats().getAvailable());
@@ -261,7 +261,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
.build(),
PoolConcurrencyPolicy.STRICT,
PoolReusePolicy.LIFO,
- TimeValue.ofMillis(100));
+ TimeValue.ofMilliseconds(100));
this.clientBuilder.setConnectionManager(this.connManager);
this.connManager.setMaxTotal(1);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java
index a2ac66f..c66b395 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java
@@ -47,7 +47,7 @@ public class TestIdleConnectionEviction extends LocalServerTestBase {
final HttpHost target = start();
- final IdleConnectionEvictor idleConnectionMonitor = new IdleConnectionEvictor(this.connManager, TimeValue.ofMillis(50));
+ final IdleConnectionEvictor idleConnectionMonitor = new IdleConnectionEvictor(this.connManager, TimeValue.ofMilliseconds(50));
idleConnectionMonitor.start();
final HttpGet httpget = new HttpGet("/random/1024");
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
index bfc4b67..2ffb065 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
@@ -108,7 +108,7 @@ public class TestSSLSocketFactory {
SSLTestContexts.createClientSSLContext(), hostVerifier);
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(
TimeValue.ZERO_MILLISECONDS,
socket,
@@ -139,7 +139,7 @@ public class TestSSLSocketFactory {
.build();
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(
TimeValue.ZERO_MILLISECONDS,
socket,
@@ -169,7 +169,7 @@ public class TestSSLSocketFactory {
SSLTestContexts.createClientSSLContext(), hostVerifier);
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(
TimeValue.ZERO_MILLISECONDS,
socket,
@@ -208,7 +208,7 @@ public class TestSSLSocketFactory {
SSLTestContexts.createClientSSLContext(), hostVerifier);
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(
TimeValue.ZERO_MILLISECONDS,
socket, target,
@@ -242,7 +242,7 @@ public class TestSSLSocketFactory {
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(TimeValue.ZERO_MILLISECONDS, socket, target, remoteAddress,
null, context)) {
// empty for now
@@ -294,7 +294,7 @@ public class TestSSLSocketFactory {
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(TimeValue.ZERO_MILLISECONDS, socket, target, remoteAddress,
null, context)) {
// empty for now
@@ -324,7 +324,7 @@ public class TestSSLSocketFactory {
SSLTestContexts.createClientSSLContext());
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(TimeValue.ZERO_MILLISECONDS, socket, target, remoteAddress,
null, context)) {
final SSLSession sslsession = sslSocket.getSession();
@@ -355,7 +355,7 @@ public class TestSSLSocketFactory {
SSLTestContexts.createClientSSLContext());
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
socketFactory.connectSocket(TimeValue.ZERO_MILLISECONDS, socket, target, remoteAddress, null, context);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
index 2776f64..2a2f9de 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
@@ -97,7 +97,7 @@ public class AsyncClientCustomSSL {
client.start();
- final HttpHost target = new HttpHost("httpbin.org", 443, "https");
+ final HttpHost target = new HttpHost("https", "httpbin.org", 443);
final String requestUri = "/";
final HttpClientContext clientContext = HttpClientContext.create();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
index d2a7f7e..a0d965a 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
@@ -138,8 +138,8 @@ public class AsyncClientFullDuplexExchange {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return responseConsumer.consume(src);
+ public void consume(final ByteBuffer src) throws IOException {
+ responseConsumer.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
index e5cd96f..9599ddb 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
@@ -134,8 +134,8 @@ public class AsyncClientHttp2FullDuplexExchange {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return responseConsumer.consume(src);
+ public void consume(final ByteBuffer src) throws IOException {
+ responseConsumer.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
index 2aea69f..bbb17b0 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
@@ -88,11 +88,6 @@ public class AsyncClientHttp2ServerPush {
}
@Override
- protected int remainingCapacity() {
- return Integer.MAX_VALUE;
- }
-
- @Override
protected int capacityIncrement() {
return Integer.MAX_VALUE;
}
@@ -133,11 +128,6 @@ public class AsyncClientHttp2ServerPush {
}
@Override
- protected int remainingCapacity() {
- return Integer.MAX_VALUE;
- }
-
- @Override
protected int capacityIncrement() {
return Integer.MAX_VALUE;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
index 03c349b..4a955b9 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
@@ -76,11 +76,6 @@ public class AsyncClientHttpExchangeStreaming {
}
@Override
- protected int remainingCapacity() {
- return Integer.MAX_VALUE;
- }
-
- @Override
protected int capacityIncrement() {
return Integer.MAX_VALUE;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
index aa1c6bf..151615c 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
@@ -79,7 +79,7 @@ public class AsyncClientTlsAlpn {
client.start();
- final HttpHost target = new HttpHost("nghttp2.org", 443, "https");
+ final HttpHost target = new HttpHost("https", "nghttp2.org", 443);
final String requestUri = "/httpbin/";
final HttpClientContext clientContext = HttpClientContext.create();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncQuickStart.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncQuickStart.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncQuickStart.java
index a6d0551..121398c 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncQuickStart.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncQuickStart.java
@@ -101,11 +101,6 @@ public class AsyncQuickStart {
}
@Override
- protected int remainingCapacity() {
- return Integer.MAX_VALUE;
- }
-
- @Override
protected int capacityIncrement() {
return Integer.MAX_VALUE;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java
index 90cb2c8..30d4751 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java
@@ -44,8 +44,8 @@ public class ClientExecuteProxy {
public static void main(final String[] args)throws Exception {
try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
- final HttpHost target = new HttpHost("httpbin.org", 443, "https");
- final HttpHost proxy = new HttpHost("127.0.0.1", 8080, "http");
+ final HttpHost target = new HttpHost("https", "httpbin.org", 443);
+ final HttpHost proxy = new HttpHost("http", "127.0.0.1", 8080);
final RequestConfig config = RequestConfig.custom()
.setProxy(proxy)
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java
index 7cb7813..9cda6a3 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java
@@ -67,7 +67,7 @@ public class ClientExecuteSOCKS {
final HttpClientContext context = HttpClientContext.create();
context.setAttribute("socks.address", socksaddr);
- final HttpHost target = new HttpHost("httpbin.org", 80, "http");
+ final HttpHost target = new HttpHost("http", "httpbin.org", 80);
final HttpGet request = new HttpGet("/get");
System.out.println("Executing request " + request.getMethod() + " " + request.getUri() +
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java
index 5eda2e6..de13335 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java
@@ -53,7 +53,7 @@ public class ClientPreemptiveBasicAuthentication {
final BasicScheme basicAuth = new BasicScheme();
basicAuth.initPreemptive(new UsernamePasswordCredentials("user", "passwd".toCharArray()));
- final HttpHost target = new HttpHost("httpbin.org", 80, "http");
+ final HttpHost target = new HttpHost("http", "httpbin.org", 80);
// Add AuthCache to the execution context
final HttpClientContext localContext = HttpClientContext.create();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java
index 04b99fd..2f40701 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java
@@ -51,7 +51,7 @@ public class ClientPreemptiveDigestAuthentication {
public static void main(final String[] args) throws Exception {
try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
- final HttpHost target = new HttpHost("httpbin.org", 80, "http");
+ final HttpHost target = new HttpHost("http", "httpbin.org", 80);
final HttpClientContext localContext = HttpClientContext.create();
final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java
index 7186fb4..18e136a 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java
@@ -53,7 +53,7 @@ public class ClientProxyAuthentication {
new UsernamePasswordCredentials("user", "passwd".toCharArray()));
try (CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCredentialsProvider(credsProvider).build()) {
- final HttpHost target = new HttpHost("httpbin.org", 80, "http");
+ final HttpHost target = new HttpHost("http", "httpbin.org", 80);
final HttpHost proxy = new HttpHost("localhost", 8888);
final RequestConfig config = RequestConfig.custom()
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
index d81ae24..12e427d 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
@@ -26,11 +26,12 @@
*/
package org.apache.hc.client5.http.examples;
-import io.reactivex.Flowable;
-import io.reactivex.Notification;
-import io.reactivex.Observable;
-import io.reactivex.functions.Consumer;
-import io.reactivex.functions.Function;
+import java.net.URI;
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.client5.http.impl.async.MinimalHttpAsyncClient;
import org.apache.hc.core5.http.ContentType;
@@ -48,11 +49,11 @@ import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
import org.reactivestreams.Publisher;
-import java.net.URI;
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
+import io.reactivex.Flowable;
+import io.reactivex.Notification;
+import io.reactivex.Observable;
+import io.reactivex.functions.Consumer;
+import io.reactivex.functions.Function;
/**
* This example demonstrates a reactive, full-duplex HTTP/1.1 message exchange using RxJava.
@@ -85,7 +86,7 @@ public class ReactiveClientFullDuplexExchange {
final Message<HttpResponse, Publisher<ByteBuffer>> streamingResponse = consumer.getResponseFuture().get();
System.out.println(streamingResponse.getHead());
- for (Header header : streamingResponse.getHead().getAllHeaders()) {
+ for (Header header : streamingResponse.getHead().getHeaders()) {
System.out.println(header.toString());
}
System.out.println();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java
index 823e600..e6685a4 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java
@@ -28,10 +28,10 @@
package org.apache.hc.client5.http.impl;
import org.apache.hc.client5.http.HttpRoute;
+import org.apache.hc.client5.http.auth.AuthSchemes;
import org.apache.hc.client5.http.auth.AuthScope;
import org.apache.hc.client5.http.auth.CredentialsStore;
import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
-import org.apache.hc.client5.http.auth.AuthSchemes;
import org.apache.hc.core5.annotation.Internal;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
@@ -78,12 +78,12 @@ public class AuthSupport {
Args.notNull(route, "Route");
final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme();
- final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();
+ final HttpHost target = authority != null ? new HttpHost(scheme, authority) : route.getTargetHost();
if (target.getPort() < 0) {
return new HttpHost(
+ target.getSchemeName(),
target.getHostName(),
- route.getTargetHost().getPort(),
- target.getSchemeName());
+ route.getTargetHost().getPort());
}
return target;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
index fcf180b..4d2b52f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
@@ -151,12 +151,10 @@ public class Http2AsyncMainClientExec implements AsyncExecChainHandler {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
+ public void consume(final ByteBuffer src) throws IOException {
final AsyncDataConsumer entityConsumer = entityConsumerRef.get();
if (entityConsumer != null) {
- return entityConsumer.consume(src);
- } else {
- return Integer.MAX_VALUE;
+ entityConsumer.consume(src);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
index fbc4b89..72dbbc4 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
@@ -214,12 +214,10 @@ class HttpAsyncMainClientExec implements AsyncExecChainHandler {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
+ public void consume(final ByteBuffer src) throws IOException {
final AsyncDataConsumer entityConsumer = entityConsumerRef.get();
if (entityConsumer != null) {
- return entityConsumer.consume(src);
- } else {
- return Integer.MAX_VALUE;
+ entityConsumer.consume(src);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
index 66356ee..175e1ea 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
@@ -169,11 +169,11 @@ final class LoggingAsyncClientExchangeHandler implements AsyncClientExchangeHand
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
+ public void consume(final ByteBuffer src) throws IOException {
if (log.isDebugEnabled()) {
log.debug(exchangeId + ": consume response data, len " + src.remaining() + " bytes");
}
- return handler.consume(src);
+ handler.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
index 680f3fe..c4f8a64 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
@@ -243,6 +243,11 @@ class LoggingIOSession implements ProtocolIOSession {
}
@Override
+ public NamedEndpoint getInitialEndpoint() {
+ return session.getInitialEndpoint();
+ }
+
+ @Override
public String toString() {
return this.id + " " + this.session.toString();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
index 7e7b82d..1f646aa 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
@@ -154,7 +154,7 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
requestConfig = clientContext.getRequestConfig();
}
final Timeout connectTimeout = requestConfig.getConnectTimeout();
- final HttpHost target = new HttpHost(request.getAuthority(), request.getScheme());
+ final HttpHost target = new HttpHost(request.getScheme(), request.getAuthority());
final Future<IOSession> sessionFuture = connPool.getSession(target, connectTimeout, new FutureCallback<IOSession>() {
@@ -215,8 +215,8 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return exchangeHandler.consume(src);
+ public void consume(final ByteBuffer src) throws IOException {
+ exchangeHandler.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
index a8ef3dc..32940e0 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
@@ -266,7 +266,7 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
final Timeout connectionRequestTimeout = requestConfig.getConnectionRequestTimeout();
final Timeout connectTimeout = requestConfig.getConnectTimeout();
final Timeout responseTimeout = requestConfig.getResponseTimeout();
- final HttpHost target = new HttpHost(request.getAuthority(), request.getScheme());
+ final HttpHost target = new HttpHost(request.getScheme(), request.getAuthority());
final Future<AsyncConnectionEndpoint> leaseFuture = leaseEndpoint(
target,
@@ -381,8 +381,8 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return exchangeHandler.consume(src);
+ public void consume(final ByteBuffer src) throws IOException {
+ exchangeHandler.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
index 204a82a..a936d06 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
@@ -93,15 +93,6 @@ public final class CloseableHttpResponse implements ClassicHttpResponse {
return response.getReasonPhrase();
}
- /**
- * @deprecated use {@link #countHeaders(String)}
- */
- @Override
- @Deprecated
- public int containsHeaders(final String name) {
- return countHeaders(name);
- }
-
@Override
public int countHeaders(final String name) {
return response.countHeaders(name);
@@ -147,15 +138,6 @@ public final class CloseableHttpResponse implements ClassicHttpResponse {
response.setLocale(loc);
}
- /**
- * @deprecated use {@link #getHeader(String)}
- */
- @Override
- @Deprecated
- public Header getSingleHeader(final String name) throws ProtocolException {
- return getHeader(name);
- }
-
@Override
public Header getHeader(final String name) throws ProtocolException {
return response.getHeader(name);
@@ -196,15 +178,6 @@ public final class CloseableHttpResponse implements ClassicHttpResponse {
return response.getLastHeader(name);
}
- /**
- * @deprecated use {@link #getHeaders()}
- */
- @Override
- @Deprecated
- public Header[] getAllHeaders() {
- return getHeaders();
- }
-
@Override
public Header[] getHeaders() {
return response.getHeaders();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java
index f47c2df..5088cf4 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java
@@ -146,7 +146,7 @@ public class ProxyClient {
Args.notNull(credentials, "Credentials");
HttpHost host = target;
if (host.getPort() <= 0) {
- host = new HttpHost(host.getHostName(), 80, host.getSchemeName());
+ host = new HttpHost(host.getSchemeName(), host.getHostName(), 80);
}
final HttpRoute route = new HttpRoute(
host,
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
index 6cb5dd6..19a4a1b 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
@@ -99,7 +99,7 @@ final class DefaultManagedHttpClientConnection
throw new InterruptedIOException("Connection already shutdown");
}
super.bind(socketHolder);
- socketTimeout = Timeout.ofMillis(socketHolder.getSocket().getSoTimeout());
+ socketTimeout = Timeout.ofMilliseconds(socketHolder.getSocket().getSoTimeout());
}
@Override
@@ -149,7 +149,7 @@ final class DefaultManagedHttpClientConnection
@Override
public void bind(final Socket socket) throws IOException {
super.bind(this.wireLog.isDebugEnabled() ? new LoggingSocketHolder(socket, this.id, this.wireLog) : new SocketHolder(socket));
- socketTimeout = Timeout.ofMillis(socket.getSoTimeout());
+ socketTimeout = Timeout.ofMilliseconds(socket.getSoTimeout());
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/SystemDefaultRoutePlanner.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/SystemDefaultRoutePlanner.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/SystemDefaultRoutePlanner.java
index 1b0b957..b62cb77 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/SystemDefaultRoutePlanner.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/SystemDefaultRoutePlanner.java
@@ -97,7 +97,7 @@ public class SystemDefaultRoutePlanner extends DefaultRoutePlanner {
}
final InetSocketAddress isa = (InetSocketAddress) p.address();
// assume default scheme (http)
- result = new HttpHost(isa.getAddress(), isa.getHostString(), isa.getPort(), null);
+ result = new HttpHost(null, isa.getAddress(), isa.getHostString(), isa.getPort());
}
return result;
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAuthCache.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAuthCache.java b/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAuthCache.java
index b9b29d2..bddaf92 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAuthCache.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAuthCache.java
@@ -93,9 +93,9 @@ public class RequestAuthCache implements HttpRequestInterceptor {
final HttpHost target;
if (authority != null) {
target = new HttpHost(
+ request.getScheme(),
authority.getHostName(),
- authority.getPort() >= 0 ? authority.getPort() : route.getTargetHost().getPort(),
- request.getScheme());
+ authority.getPort() >= 0 ? authority.getPort() : route.getTargetHost().getPort());
} else {
target = route.getTargetHost();
}
[4/4] httpcomponents-client git commit: Removed OSGi module
Posted by ol...@apache.org.
Removed OSGi module
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/5797e247
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/5797e247
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/5797e247
Branch: refs/heads/master
Commit: 5797e2475a8709cdfe7faed16ef96c30cfa73976
Parents: b452006
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Tue Dec 4 15:51:21 2018 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Dec 4 15:51:21 2018 +0100
----------------------------------------------------------------------
httpclient5-osgi/pom.xml | 186 ----------------
.../hc/client5/http/osgi/impl/HostMatcher.java | 158 -------------
.../impl/HttpClientBuilderConfigurator.java | 79 -------
.../impl/HttpProxyConfigurationActivator.java | 219 -------------------
.../impl/OSGiCachingClientBuilderFactory.java | 60 -----
.../osgi/impl/OSGiClientBuilderFactory.java | 60 -----
.../http/osgi/impl/OSGiCredentialsProvider.java | 118 ----------
.../http/osgi/impl/OSGiHttpRoutePlanner.java | 73 -------
.../http/osgi/impl/OSGiProxyConfiguration.java | 142 ------------
.../impl/OSGiTrustedHostsConfiguration.java | 104 ---------
.../client5/http/osgi/impl/PropertiesUtils.java | 205 -----------------
.../RelaxedLayeredConnectionSocketFactory.java | 91 --------
.../hc/client5/http/osgi/impl/WeakList.java | 129 -----------
.../hc/client5/http/osgi/impl/package-info.java | 27 ---
.../hc/client5/http/osgi/package-info.java | 31 ---
.../CachingHttpClientBuilderFactory.java | 35 ---
.../osgi/services/HttpClientBuilderFactory.java | 38 ----
.../http/osgi/services/ProxyConfiguration.java | 46 ----
.../services/TrustedHostsConfiguration.java | 57 -----
.../http/osgi/services/package-info.java | 31 ---
.../OSGI-INF/metatype/metatype.properties | 94 --------
.../resources/OSGI-INF/metatype/metatype.xml | 108 ---------
.../client5/http/osgi/impl/HostMatcherTest.java | 87 --------
.../osgi/impl/OSGiCredentialsProviderTest.java | 105 ---------
.../osgi/impl/OSGiProxyConfigurationTest.java | 61 ------
.../osgi/impl/TestOSGiHttpRoutePlanner.java | 117 ----------
.../impl/TestOSGiTrustedHostsConfiguration.java | 73 -------
.../http/osgi/impl/TestPropertiesUtils.java | 132 -----------
...stRelaxedLayeredConnectionSocketFactory.java | 127 -----------
.../hc/client5/http/osgi/impl/WeakListTest.java | 73 -------
httpclient5-osgi/src/test/resources/log4j2.xml | 29 ---
pom.xml | 1 -
32 files changed, 2896 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/pom.xml
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/pom.xml b/httpclient5-osgi/pom.xml
deleted file mode 100644
index 371f23f..0000000
--- a/httpclient5-osgi/pom.xml
+++ /dev/null
@@ -1,186 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ====================================================================
- 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 />.
- --><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.httpcomponents.client5</groupId>
- <artifactId>httpclient5-parent</artifactId>
- <version>5.0-beta3-SNAPSHOT</version>
- </parent>
- <artifactId>httpclient5-osgi</artifactId>
- <name>Apache HttpClient OSGi bundle</name>
- <inceptionYear>1999</inceptionYear>
- <description>
- Apache HttpComponents Client (OSGi bundle)
- </description>
- <url>http://hc.apache.org/httpcomponents-client</url>
- <packaging>bundle</packaging>
-
- <properties>
- <httpcore.osgi.import.version>"5.0-beta1"</httpcore.osgi.import.version>
- <slf4j.osgi.import.version>"[1.7, 1.8)"</slf4j.osgi.import.version>
- <osgi.framework.version>5.0.0</osgi.framework.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.httpcomponents.client5</groupId>
- <artifactId>httpclient5</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- Depend on the OSGi bundle - the bundle plugin knows what to do. -->
- <dependency>
- <groupId>org.apache.httpcomponents.core5</groupId>
- <artifactId>httpcore5-osgi</artifactId>
- <version>${httpcore.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons-codec.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents.client5</groupId>
- <artifactId>httpclient5-cache</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents.client5</groupId>
- <artifactId>httpclient5-fluent</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${osgi.framework.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>${osgi.framework.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Name>Apache ${project.name}</Bundle-Name>
- <Bundle-SymbolicName>${project.groupId}.httpclient</Bundle-SymbolicName>
- <_exportcontents>
- org.apache.hc.client5.*;version=${project.version}
- </_exportcontents>
- <Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
- <Import-Package>
- javax.crypto,
- javax.crypto.spec,
- javax.naming,
- javax.naming.directory,
- javax.naming.ldap,
- javax.net,
- javax.net.ssl,
- javax.security.auth.x500,
- org.ietf.jgss,,
- org.osgi.framework,
- org.osgi.service.cm,
- org.slf4j;version=${slf4j.osgi.import.version},
- org.apache.hc.core5.*;version=${httpcore.osgi.import.version},
- org.ehcache.*;resolution:=optional,
- net.spy.memcached.*;resolution:=optional
- </Import-Package>
- <Bundle-Activator>org.apache.hc.client5.http.osgi.impl.HttpProxyConfigurationActivator</Bundle-Activator>
- <!-- Stop the JAVA_1_n_HOME variables from being treated as headers by Bnd -->
- <_removeheaders>JAVA_1_3_HOME,JAVA_1_4_HOME</_removeheaders>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>2.22.0</version>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- <configuration>
- <systemPropertyVariables>
- <java.awt.headless>true</java.awt.headless>
- <project.build.directory>${project.build.directory}</project.build.directory>
- <project.version>${project.version}</project.version>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <finalName>org.apache.httpcomponents.httpclient_${project.version}</finalName>
- </build>
-
- <reporting>
- <plugins>
-
- <plugin>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <inherited>false</inherited>
- <reportSets>
- <reportSet>
- <reports>
- <report>dependencies</report>
- <report>dependency-info</report>
- <report>summary</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
-
- </plugins>
- </reporting>
-
-</project>
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HostMatcher.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HostMatcher.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HostMatcher.java
deleted file mode 100644
index 27f2c2f..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HostMatcher.java
+++ /dev/null
@@ -1,158 +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.client5.http.osgi.impl;
-
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-interface HostMatcher {
-
- public static final String DOT = ".";
-
- /**
- * The IP mask pattern against which hosts are matched.
- */
- public static final Pattern IP_MASK_PATTERN = Pattern.compile("^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
- "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
- "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
- "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$");
-
- boolean matches(String host);
-
- public static class HostMatcherFactory {
-
- public static HostMatcher createMatcher(final String name) {
- final NetworkAddress na = NetworkAddress.parse(name);
- if (na != null) {
- return new IPAddressMatcher(na);
- }
-
- if (name.startsWith(DOT)) {
- return new DomainNameMatcher(name);
- }
-
- return new HostNameMatcher(name);
- }
-
- }
-
- public static class HostNameMatcher implements HostMatcher {
-
- private final String hostName;
-
- HostNameMatcher(final String hostName) {
- this.hostName = hostName;
- }
-
- @Override
- public boolean matches(final String host) {
- return hostName.equalsIgnoreCase(host);
- }
- }
-
- public static class DomainNameMatcher implements HostMatcher {
-
- private final String domainName;
-
- DomainNameMatcher(final String domainName) {
- this.domainName = domainName.toLowerCase(Locale.ROOT);
- }
-
- @Override
- public boolean matches(final String host) {
- return host.toLowerCase(Locale.ROOT).endsWith(domainName);
- }
- }
-
- public static class IPAddressMatcher implements HostMatcher {
-
- private final NetworkAddress address;
-
- IPAddressMatcher(final NetworkAddress address) {
- this.address = address;
- }
-
- @Override
- public boolean matches(final String host) {
- final NetworkAddress hostAddress = NetworkAddress.parse(host);
- return hostAddress != null && address.address == (hostAddress.address & address.mask);
- }
-
- }
-
- public static class NetworkAddress {
-
- final int address;
-
- final int mask;
-
- static NetworkAddress parse(final String adrSpec) {
-
- if (null != adrSpec) {
- final Matcher nameMatcher = IP_MASK_PATTERN.matcher(adrSpec);
- if (nameMatcher.matches()) {
- try {
- final int i1 = toInt(nameMatcher.group(1), 255);
- final int i2 = toInt(nameMatcher.group(2), 255);
- final int i3 = toInt(nameMatcher.group(3), 255);
- final int i4 = toInt(nameMatcher.group(4), 255);
- final int ip = i1 << 24 | i2 << 16 | i3 << 8 | i4;
-
- int mask = toInt(nameMatcher.group(4), 32);
- mask = (mask == 32) ? -1 : -1 - (-1 >>> mask);
-
- return new NetworkAddress(ip, mask);
- } catch (final NumberFormatException nfe) {
- // not expected after the pattern match !
- }
- }
- }
-
- return null;
- }
-
- private static int toInt(final String value, final int max) {
- if (value == null || value.isEmpty()) {
- return max;
- }
-
- int number = Integer.parseInt(value);
- if (number > max) {
- number = max;
- }
- return number;
- }
-
- NetworkAddress(final int address, final int mask) {
- this.address = address;
- this.mask = mask;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpClientBuilderConfigurator.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpClientBuilderConfigurator.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpClientBuilderConfigurator.java
deleted file mode 100644
index 47f5471..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpClientBuilderConfigurator.java
+++ /dev/null
@@ -1,79 +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.client5.http.osgi.impl;
-
-import static org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory.getSocketFactory;
-
-import java.util.List;
-
-import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
-import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
-import org.apache.hc.client5.http.osgi.services.ProxyConfiguration;
-import org.apache.hc.client5.http.osgi.services.TrustedHostsConfiguration;
-import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
-import org.apache.hc.client5.http.socket.PlainConnectionSocketFactory;
-import org.apache.hc.core5.http.URIScheme;
-import org.apache.hc.core5.http.config.Registry;
-import org.apache.hc.core5.http.config.RegistryBuilder;
-
-final class HttpClientBuilderConfigurator {
-
- private final OSGiCredentialsProvider credentialsProvider;
-
- private final OSGiHttpRoutePlanner routePlanner;
-
- private final Registry<ConnectionSocketFactory> socketFactoryRegistry;
-
- HttpClientBuilderConfigurator(
- final List<ProxyConfiguration> proxyConfigurations,
- final TrustedHostsConfiguration trustedHostsConfiguration) {
- credentialsProvider = new OSGiCredentialsProvider(proxyConfigurations);
- routePlanner = new OSGiHttpRoutePlanner(proxyConfigurations);
- socketFactoryRegistry = createSocketFactoryRegistry(trustedHostsConfiguration);
- }
-
- <T extends HttpClientBuilder> T configure(final T clientBuilder) {
- clientBuilder
- .setDefaultCredentialsProvider(credentialsProvider)
- .setRoutePlanner(routePlanner)
- .setConnectionManager(new PoolingHttpClientConnectionManager(socketFactoryRegistry));
- return clientBuilder;
- }
-
- private Registry<ConnectionSocketFactory> createSocketFactoryRegistry(
- final TrustedHostsConfiguration trustedHostsConfiguration) {
- return RegistryBuilder.<ConnectionSocketFactory>create()
- .register(URIScheme.HTTP.id, PlainConnectionSocketFactory.INSTANCE)
- .register(URIScheme.HTTPS.id, createSocketFactory(trustedHostsConfiguration))
- .build();
- }
-
- private ConnectionSocketFactory createSocketFactory(
- final TrustedHostsConfiguration trustedHostsConfiguration) {
- return new RelaxedLayeredConnectionSocketFactory(trustedHostsConfiguration, getSocketFactory());
- }
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpProxyConfigurationActivator.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpProxyConfigurationActivator.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpProxyConfigurationActivator.java
deleted file mode 100644
index ffcd999..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpProxyConfigurationActivator.java
+++ /dev/null
@@ -1,219 +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.client5.http.osgi.impl;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
-import org.apache.hc.client5.http.osgi.services.CachingHttpClientBuilderFactory;
-import org.apache.hc.client5.http.osgi.services.HttpClientBuilderFactory;
-import org.apache.hc.client5.http.osgi.services.ProxyConfiguration;
-import org.apache.hc.core5.io.Closer;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.ConfigurationException;
-import org.osgi.service.cm.ManagedService;
-import org.osgi.service.cm.ManagedServiceFactory;
-
-/**
- * @since 4.3
- */
-public final class HttpProxyConfigurationActivator implements BundleActivator, ManagedServiceFactory {
-
- private static final String PROXY_SERVICE_FACTORY_NAME = "Apache HTTP Client Proxy Configuration Factory";
-
- private static final String PROXY_SERVICE_PID = "org.apache.hc.client5.http.proxyconfigurator";
-
- private static final String TRUSTED_HOSTS_SERVICE_NAME = "Apache HTTP Client Trusted Hosts Configuration";
-
- private static final String TRUSTED_HOSTS_PID = "org.apache.hc.client5.http.trustedhosts";
-
- private static final String BUILDER_FACTORY_SERVICE_NAME = "Apache HTTP Client Client Factory";
-
- private static final String BUILDER_FACTORY_SERVICE_PID = "org.apache.hc.client5.http.httpclientfactory";
-
- private static final String CACHEABLE_BUILDER_FACTORY_SERVICE_NAME = "Apache HTTP Client Caching Client Factory";
-
- private static final String CACHEABLE_BUILDER_FACTORY_SERVICE_PID = "org.apache.hc.client5.http.cachinghttpclientfactory";
-
- private ServiceRegistration<ManagedServiceFactory> configurator;
-
- private ServiceRegistration<ManagedService> trustedHostConfiguration;
-
- private ServiceRegistration<HttpClientBuilderFactory> clientFactory;
-
- private ServiceRegistration<CachingHttpClientBuilderFactory> cachingClientFactory;
-
- private BundleContext context;
-
- private final Map<String, ServiceRegistration<ProxyConfiguration>> registeredConfigurations = new LinkedHashMap<>();
-
- private final List<ProxyConfiguration> proxyConfigurations = new CopyOnWriteArrayList<>();
-
- private final HttpClientTracker httpClientTracker = new HttpClientTracker();
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void start(final BundleContext context) throws Exception {
- this.context = context;
-
- // ensure we receive configurations for the proxy selector
- final Hashtable<String, Object> props = new Hashtable<>();
- props.put(Constants.SERVICE_PID, getName());
- props.put(Constants.SERVICE_VENDOR, context.getBundle().getHeaders().get(Constants.BUNDLE_VENDOR));
- props.put(Constants.SERVICE_DESCRIPTION, PROXY_SERVICE_FACTORY_NAME);
-
- configurator = context.registerService(ManagedServiceFactory.class, this, props);
-
- props.clear();
- props.put(Constants.SERVICE_PID, TRUSTED_HOSTS_PID);
- props.put(Constants.SERVICE_VENDOR, context.getBundle().getHeaders().get(Constants.BUNDLE_VENDOR));
- props.put(Constants.SERVICE_DESCRIPTION, TRUSTED_HOSTS_SERVICE_NAME);
- final OSGiTrustedHostsConfiguration trustedHosts = new OSGiTrustedHostsConfiguration();
- trustedHostConfiguration = context.registerService(ManagedService.class, trustedHosts, props);
-
- final HttpClientBuilderConfigurator configurator =
- new HttpClientBuilderConfigurator(proxyConfigurations, trustedHosts);
-
- props.clear();
- props.put(Constants.SERVICE_PID, BUILDER_FACTORY_SERVICE_PID);
- props.put(Constants.SERVICE_VENDOR, context.getBundle().getHeaders().get(Constants.BUNDLE_VENDOR));
- props.put(Constants.SERVICE_DESCRIPTION, BUILDER_FACTORY_SERVICE_NAME);
- clientFactory = context.registerService(HttpClientBuilderFactory.class,
- new OSGiClientBuilderFactory(configurator, httpClientTracker),
- props);
-
- props.clear();
- props.put(Constants.SERVICE_PID, CACHEABLE_BUILDER_FACTORY_SERVICE_PID);
- props.put(Constants.SERVICE_VENDOR, context.getBundle().getHeaders().get(Constants.BUNDLE_VENDOR));
- props.put(Constants.SERVICE_DESCRIPTION, CACHEABLE_BUILDER_FACTORY_SERVICE_NAME);
- cachingClientFactory = context.registerService(CachingHttpClientBuilderFactory.class,
- new OSGiCachingClientBuilderFactory(configurator, httpClientTracker),
- props);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void stop(final BundleContext context) throws Exception {
- // unregister services
- for (final ServiceRegistration<ProxyConfiguration> registeredConfiguration : registeredConfigurations.values()) {
- safeUnregister(registeredConfiguration);
- }
- // remove all tracked services
- registeredConfigurations.clear();
-
- safeUnregister(configurator);
- safeUnregister(clientFactory);
- safeUnregister(cachingClientFactory);
- safeUnregister(trustedHostConfiguration);
-
- // ensure all http clients are closed
- httpClientTracker.closeAll();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return PROXY_SERVICE_PID;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void updated(final String pid, final Dictionary<String, ?> config) throws ConfigurationException {
- final ServiceRegistration<ProxyConfiguration> registration = registeredConfigurations.get(pid);
- final OSGiProxyConfiguration proxyConfiguration;
-
- if (registration == null) {
- proxyConfiguration = new OSGiProxyConfiguration();
- final ServiceRegistration<ProxyConfiguration> configurationRegistration =
- context.registerService(ProxyConfiguration.class,
- proxyConfiguration,
- config);
- registeredConfigurations.put(pid, configurationRegistration);
- proxyConfigurations.add(proxyConfiguration);
- } else {
- proxyConfiguration = (OSGiProxyConfiguration) context.getService(registration.getReference());
- }
-
- proxyConfiguration.update(config);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void deleted(final String pid) {
- final ServiceRegistration<ProxyConfiguration> registration = registeredConfigurations.remove(pid);
- if (registration != null) {
- final ServiceReference<ProxyConfiguration> ref = registration.getReference();
- final ProxyConfiguration config = context.getService(ref);
- proxyConfigurations.remove(config);
- context.ungetService(ref);
- safeUnregister(registration);
- }
- }
-
- private static <S> boolean safeUnregister(final ServiceRegistration<S> serviceRegistration) {
- if (serviceRegistration != null) {
- serviceRegistration.unregister();
- return true;
- }
- return false;
- }
-
- static class HttpClientTracker {
-
- private final List<CloseableHttpClient> trackedHttpClients = new WeakList<>();
-
- synchronized void track(final CloseableHttpClient client) {
- trackedHttpClients.add(client);
- }
-
- synchronized void closeAll() {
- for (final CloseableHttpClient client : trackedHttpClients) {
- Closer.closeQuietly(client);
- }
- trackedHttpClients.clear();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiCachingClientBuilderFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiCachingClientBuilderFactory.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiCachingClientBuilderFactory.java
deleted file mode 100644
index 3de724b..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiCachingClientBuilderFactory.java
+++ /dev/null
@@ -1,60 +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.client5.http.osgi.impl;
-
-import org.apache.hc.client5.http.impl.cache.CachingHttpClientBuilder;
-import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
-import org.apache.hc.client5.http.osgi.services.CachingHttpClientBuilderFactory;
-
-/**
- * @since 4.3
- */
-final class OSGiCachingClientBuilderFactory implements CachingHttpClientBuilderFactory {
-
- private final HttpClientBuilderConfigurator configurator;
-
- private final HttpProxyConfigurationActivator.HttpClientTracker httpClientTracker;
-
- OSGiCachingClientBuilderFactory(
- final HttpClientBuilderConfigurator configurator,
- final HttpProxyConfigurationActivator.HttpClientTracker httpClientTracker) {
- this.configurator = configurator;
- this.httpClientTracker = httpClientTracker;
- }
-
- @Override
- public CachingHttpClientBuilder newBuilder() {
- return configurator.configure(new CachingHttpClientBuilder() {
- @Override
- public CloseableHttpClient build() {
- final CloseableHttpClient client = super.build();
- httpClientTracker.track(client);
- return client;
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiClientBuilderFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiClientBuilderFactory.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiClientBuilderFactory.java
deleted file mode 100644
index 2474d27..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiClientBuilderFactory.java
+++ /dev/null
@@ -1,60 +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.client5.http.osgi.impl;
-
-import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
-import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
-import org.apache.hc.client5.http.osgi.services.HttpClientBuilderFactory;
-
-/**
- * @since 4.3
- */
-final class OSGiClientBuilderFactory implements HttpClientBuilderFactory {
-
- private final HttpClientBuilderConfigurator configurator;
-
- private final HttpProxyConfigurationActivator.HttpClientTracker httpClientTracker;
-
- OSGiClientBuilderFactory(
- final HttpClientBuilderConfigurator configurator,
- final HttpProxyConfigurationActivator.HttpClientTracker httpClientTracker) {
- this.configurator = configurator;
- this.httpClientTracker = httpClientTracker;
- }
-
- @Override
- public HttpClientBuilder newBuilder() {
- return configurator.configure(new HttpClientBuilder() {
- @Override
- public CloseableHttpClient build() {
- final CloseableHttpClient client = super.build();
- httpClientTracker.track(client);
- return client;
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiCredentialsProvider.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiCredentialsProvider.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiCredentialsProvider.java
deleted file mode 100644
index d49a7c4..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiCredentialsProvider.java
+++ /dev/null
@@ -1,118 +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.client5.http.osgi.impl;
-
-import java.util.List;
-
-import org.apache.hc.client5.http.auth.AuthScope;
-import org.apache.hc.client5.http.auth.Credentials;
-import org.apache.hc.client5.http.auth.CredentialsStore;
-import org.apache.hc.client5.http.auth.NTCredentials;
-import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
-import org.apache.hc.client5.http.osgi.services.ProxyConfiguration;
-import org.apache.hc.core5.http.protocol.HttpContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @since 4.3
- */
-final class OSGiCredentialsProvider implements CredentialsStore {
-
- private static final Logger log = LoggerFactory.getLogger(OSGiCredentialsProvider.class);
-
- private static final int HOST_AND_PORT_MATCH = 12;
-
- private static final String BASIC_SCHEME_NAME = "BASIC";
-
- private static final String NTLM_SCHEME_NAME = "NTLM";
-
- private final List<ProxyConfiguration> proxyConfigurations;
-
- OSGiCredentialsProvider(final List<ProxyConfiguration> proxyConfigurations) {
- this.proxyConfigurations = proxyConfigurations;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setCredentials(final AuthScope authscope, final Credentials credentials) {
- // do nothing, not used in this version
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Credentials getCredentials(final AuthScope authScope, final HttpContext context) {
- // iterate over all active proxy configurations at the moment of getting the credential
- for (final ProxyConfiguration config : proxyConfigurations) {
- if (config.isEnabled() && isSuitable(config, authScope)) {
- final String scheme = authScope.getAuthScheme();
- if (BASIC_SCHEME_NAME.equals(scheme)) {
- return new UsernamePasswordCredentials(config.getUsername(), config.getPassword().toCharArray());
- } else if (NTLM_SCHEME_NAME.equals(scheme)) {
- return createNTCredentials(config);
- } else {
- log.debug("credentials requested for unsupported authentication scheme " + scheme);
- }
- }
- }
- // credentials no longer available!
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void clear() {
- // do nothing, not used in this version
- }
-
- // suitable configurations match at least the host and port of the AuthScope
- private boolean isSuitable(final ProxyConfiguration config, final AuthScope authScope) {
- return authScope.match(new AuthScope(config.getHostname(), config.getPort())) >= HOST_AND_PORT_MATCH;
- }
-
- private static Credentials createNTCredentials(final ProxyConfiguration config) {
- final String domainAndUsername = config.getUsername();
- final String username;
- final String domain;
- final int index = domainAndUsername.indexOf("\\");
- if (index > -1) {
- username = domainAndUsername.substring(index + 1);
- domain = domainAndUsername.substring(0, index);
- } else {
- username = domainAndUsername;
- domain = null;
- }
- return new NTCredentials(username, config.getPassword().toCharArray(), null, domain);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiHttpRoutePlanner.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiHttpRoutePlanner.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiHttpRoutePlanner.java
deleted file mode 100644
index 2807b29..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiHttpRoutePlanner.java
+++ /dev/null
@@ -1,73 +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.client5.http.osgi.impl;
-
-import static org.apache.hc.client5.http.osgi.impl.HostMatcher.HostMatcherFactory.createMatcher;
-
-import java.util.List;
-
-import org.apache.hc.client5.http.impl.routing.DefaultRoutePlanner;
-import org.apache.hc.client5.http.osgi.services.ProxyConfiguration;
-import org.apache.hc.core5.http.HttpException;
-import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.protocol.HttpContext;
-
-/**
- * @since 4.3
- */
-final class OSGiHttpRoutePlanner extends DefaultRoutePlanner {
-
- private final List<ProxyConfiguration> proxyConfigurations;
-
- public OSGiHttpRoutePlanner(final List<ProxyConfiguration> proxyConfigurations) {
- super(null);
- this.proxyConfigurations = proxyConfigurations;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected HttpHost determineProxy(final HttpHost target, final HttpContext context) throws HttpException {
- HttpHost proxyHost = null;
- for (final ProxyConfiguration proxyConfiguration : proxyConfigurations) {
- if (proxyConfiguration.isEnabled()) {
- for (final String exception : proxyConfiguration.getProxyExceptions()) {
- if (createMatcher(exception).matches(target.getHostName())) {
- return null;
- }
- }
- if (null == proxyHost) {
- proxyHost = new HttpHost(proxyConfiguration.getHostname(), proxyConfiguration.getPort());
- }
- }
- }
-
- return proxyHost;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiProxyConfiguration.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiProxyConfiguration.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiProxyConfiguration.java
deleted file mode 100644
index 27897e5..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiProxyConfiguration.java
+++ /dev/null
@@ -1,142 +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.client5.http.osgi.impl;
-
-import static java.lang.String.format;
-import static java.util.Arrays.asList;
-import static org.apache.hc.client5.http.osgi.impl.PropertiesUtils.to;
-
-import java.util.Dictionary;
-
-import org.apache.hc.client5.http.osgi.services.ProxyConfiguration;
-
-/**
- * @since 4.3
- */
-public final class OSGiProxyConfiguration implements ProxyConfiguration {
-
- /**
- * Property indicating whether this particular proxy is enabled (shall be used or not). Defaults to true.
- */
- private static final String PROPERTYNAME_PROXY_ENABLED = "proxy.enabled";
-
- private static final Boolean PROPERTYDEFAULT_PROXY_ENABLED = Boolean.TRUE;
-
- /**
- * Property representing the hostname of the proxy. Defaults to empty.
- */
- private static final String PROPERTYNAME_PROXY_HOSTNAME = "proxy.host";
-
- private static final String PROPERTYDEFAULT_PROXY_HOSTNAME = "";
-
- /**
- * Property representing the port of the proxy. Defaults to 0.
- */
- private static final String PROPERTYNAME_PROXY_PORT = "proxy.port";
-
- private static final Integer PROPERTYDEFAULT_PROXY_PORT = Integer.valueOf(0);
-
- /**
- * Property representing the username to authenticate with towards the proxy. Defaults to empty.
- */
- private static final String PROPERTYNAME_PROXY_USERNAME = "proxy.user";
-
- private static final String PROPERTYDEFAULT_PROXY_USERNAME = "";
-
- /**
- * Property representing the password to authenticate with towards the proxy. Defaults to empty.
- */
- private static final String PROPERTYNAME_PROXY_PASSWORD = "proxy.password";
-
- private static final String PROPERTYDEFAULT_PROXY_PASSWORD = "";
-
- /**
- * A multivalue property representing host patterns for which no proxy shall be used. By default localhost is
- * excluded.
- */
- private static final String PROPERTYNAME_PROXY_EXCEPTIONS = "proxy.exceptions";
-
- private static final String[] PROPERTYDEFAULT_PROXY_EXCEPTIONS = new String[]{"localhost", "127.0.0.1"};
-
- private Boolean enabled = Boolean.FALSE; // fewer boxing conversions needed when stored as an object
-
- private String hostname;
-
- private Integer port = Integer.valueOf(0); // fewer boxing conversions needed when stored as an object
-
- private String username;
-
- private String password;
-
- private String[] proxyExceptions;
-
- @Override
- public boolean isEnabled() {
- return enabled.booleanValue();
- }
-
- @Override
- public String getHostname() {
- return hostname;
- }
-
- @Override
- public int getPort() {
- return port.intValue();
- }
-
- @Override
- public String getUsername() {
- return username;
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-
- @Override
- public String[] getProxyExceptions() {
- return proxyExceptions;
- }
-
- public void update(final Dictionary<String, ?> config) {
- enabled = to(config.get(PROPERTYNAME_PROXY_ENABLED), boolean.class, PROPERTYDEFAULT_PROXY_ENABLED);
- hostname = to(config.get(PROPERTYNAME_PROXY_HOSTNAME), String.class, PROPERTYDEFAULT_PROXY_HOSTNAME);
- port = to(config.get(PROPERTYNAME_PROXY_PORT), int.class, PROPERTYDEFAULT_PROXY_PORT);
- username = to(config.get(PROPERTYNAME_PROXY_USERNAME), String.class, PROPERTYDEFAULT_PROXY_USERNAME);
- password = to(config.get(PROPERTYNAME_PROXY_PASSWORD), String.class, PROPERTYDEFAULT_PROXY_PASSWORD);
- proxyExceptions = to(config.get(PROPERTYNAME_PROXY_EXCEPTIONS), String[].class, PROPERTYDEFAULT_PROXY_EXCEPTIONS);
- }
-
- @Override
- public String toString() {
- return format("ProxyConfiguration [enabled=%s, hostname=%s, port=%s, username=%s, password=%s, proxyExceptions=%s]",
- enabled, hostname, port, username, password, asList(proxyExceptions));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiTrustedHostsConfiguration.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiTrustedHostsConfiguration.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiTrustedHostsConfiguration.java
deleted file mode 100644
index d6c3701..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/OSGiTrustedHostsConfiguration.java
+++ /dev/null
@@ -1,104 +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.client5.http.osgi.impl;
-
-import static java.lang.String.format;
-import static java.util.Arrays.asList;
-import static org.apache.hc.client5.http.osgi.impl.PropertiesUtils.to;
-
-import java.util.Dictionary;
-
-import org.apache.hc.client5.http.osgi.services.TrustedHostsConfiguration;
-import org.osgi.service.cm.ConfigurationException;
-import org.osgi.service.cm.ManagedService;
-
-/**
- * @since 5.0-alpha2
- */
-final class OSGiTrustedHostsConfiguration implements ManagedService, TrustedHostsConfiguration {
-
- /**
- * Property indicating whether this particular configuration is enabled (shall be used or not). Defaults to true.
- */
- private static final String PROPERTYNAME_TRUSTEDHOSTS_ENABLED = "trustedhosts.enabled";
-
- private static final Boolean PROPERTYDEFAULT_TRUSTEDHOSTS_ENABLED = Boolean.TRUE;
-
- /**
- * Property indicating whether this particular configuration . Defaults to false.
- */
- private static final String PROPERTYNAME_TRUST_ALL = "trustedhosts.trustAll";
-
- private static final Boolean PROPERTYDEFAULT_TRUST_ALL = Boolean.FALSE;
-
- /**
- * A multivalue property representing host patterns which is an acceptable match with the server's authentication scheme.
- * By default <code>localhost</code> (<code>127.0.0.1</code>) is trusted.
- */
- private static final String PROPERTYNAME_TRUSTED_HOSTS = "trustedhosts.hosts";
-
- private static final String[] PROPERTYDEFAULT_TRUSTED_HOSTS = new String[]{ "localhost", "127.0.0.1" };
-
- private Boolean enabled = PROPERTYDEFAULT_TRUSTEDHOSTS_ENABLED; // fewer boxing conversions needed when stored as an object
-
- private Boolean trustAll = PROPERTYDEFAULT_TRUST_ALL; // fewer boxing conversions needed when stored as an object
-
- private String[] trustedHosts;
-
- @Override
- public boolean isEnabled() {
- return enabled;
- }
-
- @Override
- public boolean trustAll() {
- return trustAll;
- }
-
- @Override
- public String[] getTrustedHosts() {
- return trustedHosts;
- }
-
- @Override
- public void updated(final Dictionary<String, ?> config) throws ConfigurationException {
- if (config == null) {
- return;
- }
-
- enabled = to(config.get(PROPERTYNAME_TRUSTEDHOSTS_ENABLED), boolean.class, PROPERTYDEFAULT_TRUSTEDHOSTS_ENABLED);
- trustAll = to(config.get(PROPERTYNAME_TRUST_ALL), boolean.class, PROPERTYDEFAULT_TRUST_ALL);
- trustedHosts = to(config.get(PROPERTYNAME_TRUSTED_HOSTS), String[].class, PROPERTYDEFAULT_TRUSTED_HOSTS);
- }
-
- @Override
- public String toString() {
- return format("ProxyConfiguration [enabled=%s, trustAll=%s, trustedHosts=%s]",
- enabled, trustAll, asList(trustedHosts));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/PropertiesUtils.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/PropertiesUtils.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/PropertiesUtils.java
deleted file mode 100644
index faa3850..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/PropertiesUtils.java
+++ /dev/null
@@ -1,205 +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.client5.http.osgi.impl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @since 4.3
- */
-final class PropertiesUtils {
-
- private static final Map<Class<?>, PropertyConverter<?>> CONVERTERS_REGISTRY =
- new HashMap<>();
-
- static {
- register(new BooleanPropertyConverter(), boolean.class, Boolean.class);
- register(new StringPropertyConverter(), String.class);
- register(new StringArrayPropertyConverter(), String[].class);
- register(new IntegerPropertyConverter(), int.class, Integer.class);
- register(new LongPropertyConverter(), long.class, Long.class);
- register(new DoublePropertyConverter(), double.class, Double.class);
- }
-
- private static void register(final PropertyConverter<?> converter, final Class<?>...targetTypes) {
- for (final Class<?> targetType : targetTypes) {
- CONVERTERS_REGISTRY.put(targetType, converter);
- }
- }
-
- public static <T> T to(final Object propValue, final Class<T> targetType, final T defaultValue) {
- Object v = propValue;
- if (v == null) {
- return defaultValue;
- }
-
- if (!targetType.isArray()) {
- v = toObject(v);
- }
-
- if (targetType.isInstance(v)) {
- return targetType.cast(v);
- }
-
- if (CONVERTERS_REGISTRY.containsKey(targetType)) {
- @SuppressWarnings("unchecked") final // type driven by targetType
- PropertyConverter<T> converter = (PropertyConverter<T>) CONVERTERS_REGISTRY.get(targetType);
- try {
- return converter.to(v);
- } catch (final Exception ignore) {
- }
- }
-
- return defaultValue;
- }
-
- /**
- * Returns the parameter as a single value. If the
- * parameter is neither an array nor a {@code java.util.Collection} the
- * parameter is returned unmodified. If the parameter is a non-empty array,
- * the first array element is returned. If the property is a non-empty
- * {@code java.util.Collection}, the first collection element is returned.
- *
- * @param propValue the parameter to convert.
- */
- private static Object toObject(final Object propValue) {
- if (propValue.getClass().isArray()) {
- final Object[] prop = (Object[]) propValue;
- return prop.length > 0 ? prop[0] : null;
- }
-
- if (propValue instanceof Collection<?>) {
- final Collection<?> prop = (Collection<?>) propValue;
- return prop.isEmpty() ? null : prop.iterator().next();
- }
-
- return propValue;
- }
-
- /**
- * Hidden constructor, this class must not be instantiated.
- */
- private PropertiesUtils() {
- // do nothing
- }
-
- private interface PropertyConverter<T> {
-
- T to(Object propValue);
-
- }
-
- private static class BooleanPropertyConverter implements PropertyConverter<Boolean> {
-
- @Override
- public Boolean to(final Object propValue) {
- return Boolean.valueOf(String.valueOf(propValue));
- }
-
- }
-
- private static class StringPropertyConverter implements PropertyConverter<String> {
-
- @Override
- public String to(final Object propValue) {
- return String.valueOf(propValue);
- }
-
- }
-
- private static class StringArrayPropertyConverter implements PropertyConverter<String[]> {
-
- @Override
- public String[] to(final Object propValue) {
- if (propValue instanceof String) {
- // single string
- return new String[] { (String) propValue };
- }
-
- if (propValue.getClass().isArray()) {
- // other array
- final Object[] valueArray = (Object[]) propValue;
- final List<String> values = new ArrayList<>(valueArray.length);
- for (final Object value : valueArray) {
- if (value != null) {
- values.add(value.toString());
- }
- }
- return values.toArray(new String[values.size()]);
-
- }
-
- if (propValue instanceof Collection<?>) {
- // collection
- final Collection<?> valueCollection = (Collection<?>) propValue;
- final List<String> valueList = new ArrayList<>(valueCollection.size());
- for (final Object value : valueCollection) {
- if (value != null) {
- valueList.add(value.toString());
- }
- }
- return valueList.toArray(new String[valueList.size()]);
- }
-
- // don't care, fall through to default value
- throw new IllegalArgumentException();
- }
-
- }
-
- private static class IntegerPropertyConverter implements PropertyConverter<Integer> {
-
- @Override
- public Integer to(final Object propValue) {
- return Integer.valueOf(String.valueOf(propValue));
- }
-
- }
-
- private static class LongPropertyConverter implements PropertyConverter<Long> {
-
- @Override
- public Long to(final Object propValue) {
- return Long.valueOf(String.valueOf(propValue));
- }
-
- }
-
- private static class DoublePropertyConverter implements PropertyConverter<Double> {
-
- @Override
- public Double to(final Object propValue) {
- return Double.valueOf(String.valueOf(propValue));
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/RelaxedLayeredConnectionSocketFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/RelaxedLayeredConnectionSocketFactory.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/RelaxedLayeredConnectionSocketFactory.java
deleted file mode 100644
index f085857..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/RelaxedLayeredConnectionSocketFactory.java
+++ /dev/null
@@ -1,91 +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.client5.http.osgi.impl;
-
-import static org.apache.hc.client5.http.osgi.impl.HostMatcher.HostMatcherFactory.createMatcher;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-
-import org.apache.hc.client5.http.osgi.services.TrustedHostsConfiguration;
-import org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory;
-import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.util.TimeValue;
-
-final class RelaxedLayeredConnectionSocketFactory implements LayeredConnectionSocketFactory {
-
- private final TrustedHostsConfiguration trustedHostsConfiguration;
-
- private final LayeredConnectionSocketFactory defaultSocketFactory;
-
- public RelaxedLayeredConnectionSocketFactory(final TrustedHostsConfiguration trustedHostsConfiguration,
- final LayeredConnectionSocketFactory defaultSocketFactory) {
- this.trustedHostsConfiguration = trustedHostsConfiguration;
- this.defaultSocketFactory = defaultSocketFactory;
- }
-
- @Override
- public Socket createLayeredSocket(final Socket socket,
- final String target,
- final int port,
- final HttpContext context) throws IOException {
- if (trustedHostsConfiguration.isEnabled()) {
- // if trust all there is no check to perform
- if (trustedHostsConfiguration.trustAll()) {
- return socket;
- }
-
- // blindly verify the host if in the trust list
- for (final String trustedHost : trustedHostsConfiguration.getTrustedHosts()) {
- if (createMatcher(trustedHost).matches(target)) {
- return socket;
- }
- }
- }
-
- // fall back to the default behavior
- return defaultSocketFactory.createLayeredSocket(socket, target, port, context);
- }
-
- @Override
- public Socket createSocket(final HttpContext context) throws IOException {
- return defaultSocketFactory.createSocket(context);
- }
-
- @Override
- public Socket connectSocket(final TimeValue connectTimeout,
- final Socket sock,
- final HttpHost host,
- final InetSocketAddress remoteAddress,
- final InetSocketAddress localAddress,
- final HttpContext context) throws IOException {
- return defaultSocketFactory.connectSocket(connectTimeout, sock, host, remoteAddress, localAddress, context);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/WeakList.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/WeakList.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/WeakList.java
deleted file mode 100644
index 815bc04..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/WeakList.java
+++ /dev/null
@@ -1,129 +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.client5.http.osgi.impl;
-
-import java.lang.ref.WeakReference;
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.NoSuchElementException;
-
-/**
- * Implementation of a list backed by WeakReference objects.
- * This is not a general purpose list and is only meant to be used by this package. It cannot correctly manage null entries by design.
- */
-class WeakList<T> extends AbstractList<T> {
-
- private final List<WeakReference<T>> innerList;
-
- public WeakList() {
- this.innerList = new ArrayList<>();
- }
-
- @Override
- public T get(final int index) {
- return innerList.get(index).get();
- }
-
- @Override
- public int size() {
- checkReferences();
- return innerList.size();
- }
-
- @Override
- public boolean add(final T t) {
- return innerList.add(new WeakReference<>(t));
- }
-
- @Override
- public void clear() {
- innerList.clear();
- }
-
- private void checkReferences() {
- final ListIterator<WeakReference<T>> references = innerList.listIterator();
- while (references.hasNext()) {
- final WeakReference<T> reference = references.next();
- if (reference.get() == null) {
- references.remove();
- }
- }
- }
-
- @Override
- public Iterator<T> iterator() {
- return new WeakIterator<>(innerList.iterator());
- }
-
- private class WeakIterator<T> implements Iterator<T> {
-
- private final Iterator<WeakReference<T>> innerIterator;
-
- private WeakReference<T> next;
-
- public WeakIterator(final Iterator<WeakReference<T>> innerIterator) {
- this.innerIterator = innerIterator;
- fetchNext();
- }
-
- @Override
- public boolean hasNext() {
- return next != null;
- }
-
- @Override
- public T next() {
- if (next != null) {
- final T result = next.get();
- fetchNext();
- return result;
- }
- throw new NoSuchElementException();
- }
-
- private void fetchNext() {
- while (innerIterator.hasNext()) {
- final WeakReference<T> ref = innerIterator.next();
- final T obj = ref.get();
- if (obj != null) {
- next = ref;
- return;
- }
- }
- next = null;
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/package-info.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/package-info.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/package-info.java
deleted file mode 100644
index eeef615..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/package-info.java
+++ /dev/null
@@ -1,27 +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.client5.http.osgi.impl;
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/package-info.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/package-info.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/package-info.java
deleted file mode 100644
index 1cb82bc..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/package-info.java
+++ /dev/null
@@ -1,31 +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/>.
- *
- */
-
-/**
- * @since 4.3
- */
-package org.apache.hc.client5.http.osgi;
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/CachingHttpClientBuilderFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/CachingHttpClientBuilderFactory.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/CachingHttpClientBuilderFactory.java
deleted file mode 100644
index d94e84b..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/CachingHttpClientBuilderFactory.java
+++ /dev/null
@@ -1,35 +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.client5.http.osgi.services;
-
-import org.apache.hc.client5.http.impl.cache.CachingHttpClientBuilder;
-
-public interface CachingHttpClientBuilderFactory {
-
- CachingHttpClientBuilder newBuilder();
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/HttpClientBuilderFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/HttpClientBuilderFactory.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/HttpClientBuilderFactory.java
deleted file mode 100644
index b0b62b4..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/HttpClientBuilderFactory.java
+++ /dev/null
@@ -1,38 +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.client5.http.osgi.services;
-
-import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
-
-/**
- * @since 4.3
- */
-public interface HttpClientBuilderFactory {
-
- HttpClientBuilder newBuilder();
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/ProxyConfiguration.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/ProxyConfiguration.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/ProxyConfiguration.java
deleted file mode 100644
index f539762..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/ProxyConfiguration.java
+++ /dev/null
@@ -1,46 +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.client5.http.osgi.services;
-
-/**
- * @since 4.3
- */
-public interface ProxyConfiguration {
-
- boolean isEnabled();
-
- String getHostname();
-
- int getPort();
-
- String getUsername();
-
- String getPassword();
-
- String[] getProxyExceptions();
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/TrustedHostsConfiguration.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/TrustedHostsConfiguration.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/TrustedHostsConfiguration.java
deleted file mode 100644
index fc23316..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/TrustedHostsConfiguration.java
+++ /dev/null
@@ -1,57 +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.client5.http.osgi.services;
-
-/**
- * @since 5.0-alpha2
- */
-public interface TrustedHostsConfiguration {
-
- /**
- * Flag to mark if current configuration has to be processed when creating SSL sessions..
- *
- * @return true if current configuration has to be processed when creating an SSL session, false otherwise.
- */
- boolean isEnabled();
-
- /**
- * Flag to mark all SSL certificates are blindly trusted by the client.
- *
- * Pay attention on no enabling this feature in production environment as it is totally insecure.
- *
- * @return true if all SSL certificates are blindly trusted by the client, false otherwise.
- */
- boolean trustAll();
-
- /**
- * The list of trusted hosts for which self-signed certificate is acceptable.
- *
- * @return an array representing the list of trusted hosts for which self-signed certificate is acceptable.
- */
- String[] getTrustedHosts();
-
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5797e247/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/package-info.java
----------------------------------------------------------------------
diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/package-info.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/package-info.java
deleted file mode 100644
index a8e2267..0000000
--- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/services/package-info.java
+++ /dev/null
@@ -1,31 +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/>.
- *
- */
-
-/**
- * @since 4.3
- */
-package org.apache.hc.client5.http.osgi.services;