use of software.amazon.awssdk.http.async.SdkAsyncHttpClient 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.http.async.SdkAsyncHttpClient in project flink by apache.
the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithDefaultsProtocol.
@Test
public void testCreateNettyAsyncHttpClientWithDefaultsProtocol() throws Exception {
NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(builder);
NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
assertEquals(HTTP2, nettyConfiguration.attribute(SdkHttpConfigurationOption.PROTOCOL));
}
use of software.amazon.awssdk.http.async.SdkAsyncHttpClient 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.http.async.SdkAsyncHttpClient in project flink by apache.
the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithPropertyMaxConcurrency.
@Test
public void testCreateNettyAsyncHttpClientWithPropertyMaxConcurrency() throws Exception {
int maxConnections = 45678;
Properties properties = new Properties();
properties.setProperty(AWSConfigConstants.HTTP_CLIENT_MAX_CONCURRENCY, String.valueOf(maxConnections));
SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(properties);
NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
assertEquals(maxConnections, nettyConfiguration.maxConnections());
}
use of software.amazon.awssdk.http.async.SdkAsyncHttpClient in project flink by apache.
the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithDefaultsIdleTimeout.
@Test
public void testCreateNettyAsyncHttpClientWithDefaultsIdleTimeout() 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.idleTimeoutMillis(), nettyConfiguration.idleTimeoutMillis());
}
Aggregations