Search in sources :

Example 31 with SdkAsyncHttpClient

use of software.amazon.awssdk.http.async.SdkAsyncHttpClient in project flink by apache.

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientIdleConnectionTtl.

@Test
public void testCreateNettyAsyncHttpClientIdleConnectionTtl() throws Exception {
    Duration connectionTtl = Duration.ofMillis(5000);
    AttributeMap clientConfiguration = AttributeMap.builder().put(SdkHttpConfigurationOption.CONNECTION_TIME_TO_LIVE, connectionTtl).build();
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(clientConfiguration, builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(connectionTtl.toMillis(), nettyConfiguration.connectionTtlMillis());
}
Also used : AttributeMap(software.amazon.awssdk.utils.AttributeMap) NettyNioAsyncHttpClient(software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient) NettyConfiguration(software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration) Duration(java.time.Duration) SdkAsyncHttpClient(software.amazon.awssdk.http.async.SdkAsyncHttpClient) Test(org.junit.Test)

Example 32 with SdkAsyncHttpClient

use of software.amazon.awssdk.http.async.SdkAsyncHttpClient in project flink by apache.

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithDefaultsReadTimeout.

@Test
public void testCreateNettyAsyncHttpClientWithDefaultsReadTimeout() throws Exception {
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(360_000, nettyConfiguration.readTimeoutMillis());
}
Also used : NettyNioAsyncHttpClient(software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient) NettyConfiguration(software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration) SdkAsyncHttpClient(software.amazon.awssdk.http.async.SdkAsyncHttpClient) Test(org.junit.Test)

Example 33 with SdkAsyncHttpClient

use of software.amazon.awssdk.http.async.SdkAsyncHttpClient in project flink by apache.

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithDefaultsMaxPendingConnectionAcquires.

@Test
public void testCreateNettyAsyncHttpClientWithDefaultsMaxPendingConnectionAcquires() throws Exception {
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    SdkAsyncHttpClient httpDefaultClient = NettyNioAsyncHttpClient.create();
    NettyConfiguration nettyDefaultConfiguration = TestUtil.getNettyConfiguration(httpDefaultClient);
    assertEquals(nettyDefaultConfiguration.maxPendingConnectionAcquires(), nettyConfiguration.maxPendingConnectionAcquires());
}
Also used : NettyNioAsyncHttpClient(software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient) NettyConfiguration(software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration) SdkAsyncHttpClient(software.amazon.awssdk.http.async.SdkAsyncHttpClient) Test(org.junit.Test)

Example 34 with SdkAsyncHttpClient

use of software.amazon.awssdk.http.async.SdkAsyncHttpClient in project flink by apache.

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithDefaultsMaxConnections.

@Test
public void testCreateNettyAsyncHttpClientWithDefaultsMaxConnections() throws Exception {
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(10_000, nettyConfiguration.maxConnections());
}
Also used : NettyNioAsyncHttpClient(software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient) NettyConfiguration(software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration) SdkAsyncHttpClient(software.amazon.awssdk.http.async.SdkAsyncHttpClient) Test(org.junit.Test)

Example 35 with SdkAsyncHttpClient

use of software.amazon.awssdk.http.async.SdkAsyncHttpClient in project flink by apache.

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientTrustAllCertificates.

@Test
public void testCreateNettyAsyncHttpClientTrustAllCertificates() throws Exception {
    boolean trustAllCertificates = true;
    AttributeMap clientConfiguration = AttributeMap.builder().put(SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES, trustAllCertificates).build();
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(clientConfiguration, builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(trustAllCertificates, nettyConfiguration.trustAllCertificates());
}
Also used : AttributeMap(software.amazon.awssdk.utils.AttributeMap) NettyNioAsyncHttpClient(software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient) NettyConfiguration(software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration) SdkAsyncHttpClient(software.amazon.awssdk.http.async.SdkAsyncHttpClient) Test(org.junit.Test)

Aggregations

SdkAsyncHttpClient (software.amazon.awssdk.http.async.SdkAsyncHttpClient)39 Test (org.junit.Test)37 NettyConfiguration (software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration)29 NettyNioAsyncHttpClient (software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient)25 AttributeMap (software.amazon.awssdk.utils.AttributeMap)11 Properties (java.util.Properties)8 Duration (java.time.Duration)6 Segment (com.amazonaws.xray.entities.Segment)5 Subsegment (com.amazonaws.xray.entities.Subsegment)5 Map (java.util.Map)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 LambdaAsyncClient (software.amazon.awssdk.services.lambda.LambdaAsyncClient)5 Cause (com.amazonaws.xray.entities.Cause)4 ClientOverrideConfiguration (software.amazon.awssdk.core.client.config.ClientOverrideConfiguration)3 KinesisAsyncClient (software.amazon.awssdk.services.kinesis.KinesisAsyncClient)3 URI (java.net.URI)2 Mockito.never (org.mockito.Mockito.never)2 Mockito.verify (org.mockito.Mockito.verify)2 Mockito.when (org.mockito.Mockito.when)2 AWSXRay (com.amazonaws.xray.AWSXRay)1