public ClientConfiguration newClientConfiguration(S3SinkConnectorConfig config) { String version = String.format(VERSION_FORMAT, Version.getVersion()); ClientConfiguration clientConfiguration = PredefinedClientConfigurations.defaultConfig(); clientConfiguration.withUserAgentPrefix(version); if (StringUtils.isNotBlank(config.getString(S3_PROXY_URL_CONFIG))) { S3ProxyConfig proxyConfig = new S3ProxyConfig(config); clientConfiguration.withProtocol(proxyConfig.protocol()) .withProxyHost(proxyConfig.host()) .withProxyPort(proxyConfig.port()) .withProxyUsername(proxyConfig.user()) .withProxyPassword(proxyConfig.pass()); } return clientConfiguration; }
@Test public void defaultClientConfigAndNoExplicitExecutor_UsesDefaultExecutorBasedOnMaxConns() { ExecutorService executor = builderWithRegion().build().getAsyncParams().getExecutor(); assertThat(executor, instanceOf(ThreadPoolExecutor.class)); assertEquals(PredefinedClientConfigurations.defaultConfig().getMaxConnections(), ((ThreadPoolExecutor) executor).getMaximumPoolSize()); }
private AWSKMS getClient() throws IOException { AWSKMSClientBuilder clientBuilder = AWSKMSClientBuilder.standard(); ClientConfiguration clientConfig = PredefinedClientConfigurations.defaultConfig(); String proxyHost = ConfigManager.getEnvironmentVariable(ConfigKeys.ProxyHost); if (proxyHost != null) { clientConfig.setProxyHost(proxyHost); clientConfig.setProxyPort(Integer.parseInt(ConfigManager.getEnvironmentVariable(ConfigKeys.ProxyPort))); } clientBuilder.setClientConfiguration(clientConfig); return clientBuilder.build(); }