use of software.amazon.awssdk.http.apache.ProxyConfiguration in project beam by apache.
the class ClientBuilderFactoryTest method testSyncProxyConfiguration.
@Test
public void testSyncProxyConfiguration() {
ProxyConfiguration proxy = ProxyConfiguration.builder().endpoint(URI.create("http://localhost:7777")).username("user").password("secret").build();
builder = mock(AwsSyncBuilder.class);
when(awsOptions.getProxyConfiguration()).thenReturn(proxy);
getFactory(awsOptions).create(builder, awsOptions);
ArgumentCaptor<ApacheHttpClient.Builder> httpClientBuilder = ArgumentCaptor.forClass(ApacheHttpClient.Builder.class);
verify((AwsSyncBuilder) builder).httpClientBuilder(httpClientBuilder.capture());
verify(httpClientBuilder.getValue()).proxyConfiguration(proxy);
verifyNoMoreInteractions(httpClientBuilder.getValue());
}
use of software.amazon.awssdk.http.apache.ProxyConfiguration in project beam by apache.
the class ClientBuilderFactoryTest method testAsyncProxyConfiguration.
@Test
public void testAsyncProxyConfiguration() {
ProxyConfiguration proxy = ProxyConfiguration.builder().endpoint(URI.create("http://localhost:7777")).username("user").password("secret").build();
software.amazon.awssdk.http.nio.netty.ProxyConfiguration nettyProxy = software.amazon.awssdk.http.nio.netty.ProxyConfiguration.builder().scheme(proxy.scheme()).host(proxy.host()).port(proxy.port()).username(proxy.username()).password(proxy.password()).nonProxyHosts(proxy.nonProxyHosts()).build();
builder = mock(AwsAsyncBuilder.class);
when(awsOptions.getProxyConfiguration()).thenReturn(proxy);
getFactory(awsOptions).create(builder, awsOptions);
ArgumentCaptor<NettyNioAsyncHttpClient.Builder> httpClientBuilder = ArgumentCaptor.forClass(NettyNioAsyncHttpClient.Builder.class);
verify((AwsAsyncBuilder) builder).httpClientBuilder(httpClientBuilder.capture());
verify(httpClientBuilder.getValue()).proxyConfiguration(nettyProxy);
verifyNoMoreInteractions(httpClientBuilder.getValue());
}
use of software.amazon.awssdk.http.apache.ProxyConfiguration in project beam by apache.
the class AwsModuleTest method testProxyConfigurationSerializationDeserialization.
@Test
public void testProxyConfigurationSerializationDeserialization() throws Exception {
ProxyConfiguration proxyConfiguration = ProxyConfiguration.builder().endpoint(URI.create("http://localhost:8080")).username("username").password("password").build();
ProxyConfiguration deserializedProxyConfiguration = serializeAndDeserialize(proxyConfiguration);
assertEquals("localhost", deserializedProxyConfiguration.host());
assertEquals(8080, deserializedProxyConfiguration.port());
assertEquals("username", deserializedProxyConfiguration.username());
assertEquals("password", deserializedProxyConfiguration.password());
}
use of software.amazon.awssdk.http.apache.ProxyConfiguration in project beam by apache.
the class AwsOptionsTest method testSetProxyConfiguration.
@Test
public void testSetProxyConfiguration() {
AwsOptions options = create("--proxyConfiguration={\"endpoint\":\"https://localhost:8080\", \"username\":\"user\", \"password\":\"pw\"}");
ProxyConfiguration expected = ProxyConfiguration.builder().endpoint(URI.create("https://localhost:8080")).username("user").password("pw").build();
assertThat(options.getProxyConfiguration()).isEqualToIgnoringGivenFields(expected, "useSystemPropertyValues");
assertThat(serializeDeserialize(options).getProxyConfiguration()).isEqualToIgnoringGivenFields(expected, "useSystemPropertyValues");
}
Aggregations