use of software.amazon.awssdk.http.async.SdkAsyncHttpClient in project flink by apache.
the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithDefaultsConnectionTtl.
@Test
public void testCreateNettyAsyncHttpClientWithDefaultsConnectionTtl() 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.connectionTtlMillis(), nettyConfiguration.connectionTtlMillis());
}
use of software.amazon.awssdk.http.async.SdkAsyncHttpClient 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.http.async.SdkAsyncHttpClient 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.http.async.SdkAsyncHttpClient in project flink by apache.
the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithPropertyReadTimeout.
@Test
public void testCreateNettyAsyncHttpClientWithPropertyReadTimeout() throws Exception {
int readTimeoutMillis = 45678;
Properties properties = new Properties();
properties.setProperty(AWSConfigConstants.HTTP_CLIENT_READ_TIMEOUT_MILLIS, String.valueOf(readTimeoutMillis));
SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(properties);
NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
assertEquals(readTimeoutMillis, nettyConfiguration.readTimeoutMillis());
}
use of software.amazon.awssdk.http.async.SdkAsyncHttpClient in project flink by apache.
the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithPropertyTcpKeepAlive.
@Test
public void testCreateNettyAsyncHttpClientWithPropertyTcpKeepAlive() throws Exception {
SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(new Properties());
NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
assertTrue(nettyConfiguration.tcpKeepAlive());
}
Aggregations