Search in sources :

Example 11 with NettyConfiguration

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

Example 12 with NettyConfiguration

use of software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration in project flink by apache.

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithDefaultsTlsKeyManagersProvider.

@Test
public void testCreateNettyAsyncHttpClientWithDefaultsTlsKeyManagersProvider() 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.tlsKeyManagersProvider(), nettyConfiguration.tlsKeyManagersProvider());
}
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 13 with NettyConfiguration

use of software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration in project flink by apache.

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientReadTimeout.

@Test
public void testCreateNettyAsyncHttpClientReadTimeout() throws Exception {
    Duration readTimeout = Duration.ofMillis(1234);
    AttributeMap clientConfiguration = AttributeMap.builder().put(SdkHttpConfigurationOption.READ_TIMEOUT, readTimeout).build();
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(clientConfiguration, builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(readTimeout.toMillis(), nettyConfiguration.readTimeoutMillis());
}
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 14 with NettyConfiguration

use of software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration in project flink by apache.

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientWithDefaultsConnectionTimeout.

@Test
public void testCreateNettyAsyncHttpClientWithDefaultsConnectionTimeout() 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.connectTimeoutMillis(), nettyConfiguration.connectTimeoutMillis());
}
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 15 with NettyConfiguration

use of software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration in project flink by apache.

the class KinesisProxyV2FactoryTest method testReadTimeoutPopulatedFromDefaults.

@Test
public void testReadTimeoutPopulatedFromDefaults() throws Exception {
    Properties properties = properties();
    KinesisProxyV2Interface proxy = KinesisProxyV2Factory.createKinesisProxyV2(properties);
    NettyConfiguration nettyConfiguration = getNettyConfiguration(proxy);
    assertEquals(DEFAULT_EFO_HTTP_CLIENT_READ_TIMEOUT.toMillis(), nettyConfiguration.readTimeoutMillis());
}
Also used : NettyConfiguration(software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration) Properties(java.util.Properties) 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