use of software.amazon.awssdk.crt.http.HttpClientConnectionManager in project aws-crt-java by awslabs.
the class ProxyTest method testConnectionManager_TunnelingHttpProxy_BasicAuth.
@Test
public void testConnectionManager_TunnelingHttpProxy_BasicAuth() {
skipIfNetworkUnavailable();
Assume.assumeTrue(isEnvironmentSetUpForProxyTests());
try (HttpClientConnectionManager manager = buildProxiedConnectionManager(ProxyTestType.TUNNELING_HTTP, ProxyAuthType.Basic)) {
doHttpConnectionManagerProxyTest(manager);
}
}
use of software.amazon.awssdk.crt.http.HttpClientConnectionManager in project aws-crt-java by awslabs.
the class ProxyTest method testConnectionManager_LegacyHttpProxy_NoAuth.
@Test
public void testConnectionManager_LegacyHttpProxy_NoAuth() {
skipIfNetworkUnavailable();
Assume.assumeTrue(isEnvironmentSetUpForProxyTests());
try (HttpClientConnectionManager manager = buildProxiedConnectionManager(ProxyTestType.LEGACY_HTTP, ProxyAuthType.None)) {
doHttpConnectionManagerProxyTest(manager);
}
}
use of software.amazon.awssdk.crt.http.HttpClientConnectionManager in project aws-crt-java by awslabs.
the class ProxyTest method testConnectionManager_ForwardingProxy_NoAuth.
@Test
public void testConnectionManager_ForwardingProxy_NoAuth() {
skipIfNetworkUnavailable();
Assume.assumeTrue(isEnvironmentSetUpForProxyTests());
try (HttpClientConnectionManager manager = buildProxiedConnectionManager(ProxyTestType.FORWARDING, ProxyAuthType.None)) {
doHttpConnectionManagerProxyTest(manager);
}
}
use of software.amazon.awssdk.crt.http.HttpClientConnectionManager in project aws-crt-java by awslabs.
the class HttpClientConnectionManagerTest method testPendingAcquisitionsDuringShutdown.
@Test
public void testPendingAcquisitionsDuringShutdown() throws Exception {
skipIfNetworkUnavailable();
HttpClientConnection firstConnection = null;
CompletableFuture<HttpClientConnection> firstAcquisition;
CompletableFuture<HttpClientConnection> secondAcquisition;
try (HttpClientConnectionManager connectionPool = createConnectionManager(new URI(endpoint), 1, 1)) {
firstAcquisition = connectionPool.acquireConnection();
secondAcquisition = connectionPool.acquireConnection();
firstConnection = firstAcquisition.get();
}
firstConnection.close();
}
use of software.amazon.awssdk.crt.http.HttpClientConnectionManager in project aws-crt-java by awslabs.
the class HttpClientConnectionManagerTest method testCancelAcquire.
@Test
public void testCancelAcquire() throws Exception {
// related: https://github.com/awslabs/aws-sdk-kotlin/issues/511
skipIfNetworkUnavailable();
try (HttpClientConnectionManager connectionPool = createConnectionManager(new URI(endpoint), 1, 1)) {
CompletableFuture<HttpClientConnection> firstAcquisition = connectionPool.acquireConnection();
CompletableFuture<HttpClientConnection> secondAcquisition = connectionPool.acquireConnection();
CompletableFuture<HttpClientConnection> thirdAcquisition = connectionPool.acquireConnection();
HttpClientConnection firstConnection = firstAcquisition.get();
// cancel acquisition and abandon it
secondAcquisition.cancel(false);
// return the first conn to the pool, future acquisitions should succeed
firstConnection.close();
// should succeed, will timeout if the second acquisition doesn't return the unused/abandoned conn to the pool
HttpClientConnection conn = thirdAcquisition.get(500, TimeUnit.MILLISECONDS);
conn.close();
}
}
Aggregations