Search in sources :

Example 6 with NettyConfiguration

use of software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration 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 7 with NettyConfiguration

use of software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration 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));
}
Also used : 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 8 with NettyConfiguration

use of software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration 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 9 with NettyConfiguration

use of software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration 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());
}
Also used : NettyConfiguration(software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration) SdkAsyncHttpClient(software.amazon.awssdk.http.async.SdkAsyncHttpClient) Properties(java.util.Properties) Test(org.junit.Test)

Example 10 with NettyConfiguration

use of software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration 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());
}
Also used : 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

Test (org.junit.Test)32 NettyConfiguration (software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration)32 SdkAsyncHttpClient (software.amazon.awssdk.http.async.SdkAsyncHttpClient)29 NettyNioAsyncHttpClient (software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient)24 AttributeMap (software.amazon.awssdk.utils.AttributeMap)10 Properties (java.util.Properties)8 Duration (java.time.Duration)5 Protocol (software.amazon.awssdk.http.Protocol)2