Search in sources :

Example 11 with AttributeMap

use of software.amazon.awssdk.utils.AttributeMap in project flink by apache.

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientIdleConnectionReaper.

@Test
public void testCreateNettyAsyncHttpClientIdleConnectionReaper() throws Exception {
    boolean reapIdleConnections = false;
    AttributeMap clientConfiguration = AttributeMap.builder().put(SdkHttpConfigurationOption.REAP_IDLE_CONNECTIONS, reapIdleConnections).build();
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(clientConfiguration, builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(reapIdleConnections, nettyConfiguration.reapIdleConnections());
}
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)

Example 12 with AttributeMap

use of software.amazon.awssdk.utils.AttributeMap 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 13 with AttributeMap

use of software.amazon.awssdk.utils.AttributeMap 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)

Example 14 with AttributeMap

use of software.amazon.awssdk.utils.AttributeMap 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

AttributeMap (software.amazon.awssdk.utils.AttributeMap)14 Test (org.junit.Test)13 SdkAsyncHttpClient (software.amazon.awssdk.http.async.SdkAsyncHttpClient)11 NettyNioAsyncHttpClient (software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient)10 NettyConfiguration (software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration)10 Duration (java.time.Duration)6 Properties (java.util.Properties)4 FanOutRecordPublisherConfiguration (org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.FanOutRecordPublisherConfiguration)1 Protocol (software.amazon.awssdk.http.Protocol)1 KinesisAsyncClient (software.amazon.awssdk.services.kinesis.KinesisAsyncClient)1