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());
}
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());
}
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));
}
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());
}
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());
}
Aggregations