Search in sources :

Example 1 with AttributeMap

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

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientTcpKeepAlive.

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

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

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientConnectionMaxIdleTime.

@Test
public void testCreateNettyAsyncHttpClientConnectionMaxIdleTime() throws Exception {
    Duration maxIdleTime = Duration.ofMillis(2000);
    AttributeMap clientConfiguration = AttributeMap.builder().put(SdkHttpConfigurationOption.CONNECTION_MAX_IDLE_TIMEOUT, maxIdleTime).build();
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(clientConfiguration, builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(maxIdleTime.toMillis(), nettyConfiguration.idleTimeoutMillis());
}
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 3 with AttributeMap

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

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientHttpVersion.

@Test
public void testCreateNettyAsyncHttpClientHttpVersion() throws Exception {
    Protocol httpVersion = HTTP1_1;
    AttributeMap clientConfiguration = AttributeMap.builder().put(SdkHttpConfigurationOption.PROTOCOL, httpVersion).build();
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(clientConfiguration, builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(httpVersion, nettyConfiguration.attribute(SdkHttpConfigurationOption.PROTOCOL));
}
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) Protocol(software.amazon.awssdk.http.Protocol) Test(org.junit.Test)

Example 4 with AttributeMap

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

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientConnectionTimeout.

@Test
public void testCreateNettyAsyncHttpClientConnectionTimeout() throws Exception {
    Duration connectionTimeout = Duration.ofMillis(1000);
    AttributeMap clientConfiguration = AttributeMap.builder().put(SdkHttpConfigurationOption.CONNECTION_TIMEOUT, connectionTimeout).build();
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(clientConfiguration, builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(connectionTimeout.toMillis(), nettyConfiguration.connectTimeoutMillis());
}
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 5 with AttributeMap

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

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWriteTimeout.

@Test
public void testCreateNettyAsyncHttpClientWriteTimeout() throws Exception {
    Duration writeTimeout = Duration.ofMillis(3000);
    AttributeMap clientConfiguration = AttributeMap.builder().put(SdkHttpConfigurationOption.WRITE_TIMEOUT, writeTimeout).build();
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(clientConfiguration, builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(writeTimeout.toMillis(), nettyConfiguration.writeTimeoutMillis());
}
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)

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