Search in sources :

Example 36 with SdkAsyncHttpClient

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

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithDefaultsConnectionAcquireTimeout.

@Test
public void testCreateNettyAsyncHttpClientWithDefaultsConnectionAcquireTimeout() throws Exception {
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(60_000, nettyConfiguration.connectionAcquireTimeoutMillis());
}
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 37 with SdkAsyncHttpClient

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

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithPropertyTrustAllCertificates.

@Test
public void testCreateNettyAsyncHttpClientWithPropertyTrustAllCertificates() throws Exception {
    boolean trustAllCerts = true;
    Properties properties = new Properties();
    properties.setProperty(AWSConfigConstants.TRUST_ALL_CERTIFICATES, String.valueOf(trustAllCerts));
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(properties);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(trustAllCerts, nettyConfiguration.trustAllCertificates());
}
Also used : NettyConfiguration(software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration) SdkAsyncHttpClient(software.amazon.awssdk.http.async.SdkAsyncHttpClient) Properties(java.util.Properties) Test(org.junit.Test)

Example 38 with SdkAsyncHttpClient

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

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithDefaultsWriteTimeout.

@Test
public void testCreateNettyAsyncHttpClientWithDefaultsWriteTimeout() 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.writeTimeoutMillis(), nettyConfiguration.writeTimeoutMillis());
}
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 39 with SdkAsyncHttpClient

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

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientMaxConcurrency.

@Test
public void testCreateNettyAsyncHttpClientMaxConcurrency() throws Exception {
    int maxConnections = 123;
    AttributeMap clientConfiguration = AttributeMap.builder().put(SdkHttpConfigurationOption.MAX_CONNECTIONS, maxConnections).build();
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(clientConfiguration, builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(maxConnections, nettyConfiguration.maxConnections());
}
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