/** * Sets the amount of time to wait (in milliseconds) when initially establishing a connection * before giving up and timing out, and returns the updated ClientConfiguration object so that * additional method calls may be chained together. * * @param connectionTimeout * the amount of time to wait (in milliseconds) when initially establishing a * connection before giving up and timing out. * @return The updated ClientConfiguration object. */ public ClientConfiguration withConnectionTimeout(int connectionTimeout) { setConnectionTimeout(connectionTimeout); return this; }
static ClientConfiguration s3ClientCfg() { ClientConfiguration cfg = new ClientConfiguration(); Properties prop = System.getProperties(); if( prop.containsKey(S3_SOCKET_TIMEOUT_PROP) ) cfg.setSocketTimeout(Integer.getInteger(S3_SOCKET_TIMEOUT_PROP)); if( prop.containsKey(S3_CONNECTION_TIMEOUT_PROP) ) cfg.setConnectionTimeout(Integer .getInteger(S3_CONNECTION_TIMEOUT_PROP)); if( prop.containsKey(S3_MAX_ERROR_RETRY_PROP) ) cfg.setMaxErrorRetry(Integer.getInteger(S3_MAX_ERROR_RETRY_PROP)); if( prop.containsKey(S3_MAX_HTTP_CONNECTIONS_PROP) ) cfg.setMaxConnections(Integer .getInteger(S3_MAX_HTTP_CONNECTIONS_PROP)); cfg.setProtocol(Protocol.HTTP); return cfg; }
/** * Sets the amount of time to wait (in milliseconds) when initially establishing a connection * before giving up and timing out, and returns the updated ClientConfiguration object so that * additional method calls may be chained together. * * @param connectionTimeout * the amount of time to wait (in milliseconds) when initially establishing a * connection before giving up and timing out. * @return The updated ClientConfiguration object. */ public ClientConfiguration withConnectionTimeout(int connectionTimeout) { setConnectionTimeout(connectionTimeout); return this; }
/** * Sets the amount of time to wait (in milliseconds) when initially * establishing a connection before giving up and timing out, and returns * the updated ClientConfiguration object so that additional method calls * may be chained together. * * @param connectionTimeout the amount of time to wait (in milliseconds) * when initially establishing a connection before giving up and * timing out. * @return The updated ClientConfiguration object. */ @SuppressWarnings("checkstyle:hiddenfield") public ClientConfiguration withConnectionTimeout(int connectionTimeout) { setConnectionTimeout(connectionTimeout); return this; }
config.setConnectionTimeout(commsTimeout); config.setSocketTimeout(commsTimeout);
@Test public void testGetConnectionTimeout() { assertEquals(HttpUtils.getConnectionTimeout(null), ClientConfiguration.DEFAULT_CONNECTION_TIMEOUT); final ClientConfiguration conf = new ClientConfiguration(); conf.setConnectionTimeout(10); assertEquals(HttpUtils.getConnectionTimeout(conf), 10); }
@Test public void testInstantiateClientNoCredentials() { final Region usEast1 = Region.getRegion(Regions.US_EAST_1); final ClientConfiguration conf = new ClientConfiguration(); conf.setConnectionTimeout(5); final AmazonServiceClient asc = usEast1.createClient(AmazonServiceClient.class, null, conf); assertNotNull(asc); assertSame(asc.conf, conf); assertNull(asc.provider); }
/** * Sets the amount of time to wait (in milliseconds) when initially establishing a connection * before giving up and timing out, and returns the updated ClientConfiguration object so that * additional method calls may be chained together. * * @param connectionTimeout * the amount of time to wait (in milliseconds) when initially establishing a * connection before giving up and timing out. * @return The updated ClientConfiguration object. */ public ClientConfiguration withConnectionTimeout(int connectionTimeout) { setConnectionTimeout(connectionTimeout); return this; }
/** * Sets the amount of time to wait (in milliseconds) when initially * establishing a connection before giving up and timing out, and returns * the updated ClientConfiguration object so that additional method calls * may be chained together. * * @param connectionTimeout the amount of time to wait (in milliseconds) * when initially establishing a connection before giving up and * timing out. * @return The updated ClientConfiguration object. */ @SuppressWarnings("checkstyle:hiddenfield") public ClientConfiguration withConnectionTimeout(int connectionTimeout) { setConnectionTimeout(connectionTimeout); return this; }
configuration.setConnectionTimeout(clientOptions.getConnectionTimeout());
/** * Sets the amount of time to wait (in milliseconds) when initially * establishing a connection before giving up and timing out, and returns * the updated ClientConfiguration object so that additional method calls * may be chained together. * * @param connectionTimeout the amount of time to wait (in milliseconds) * when initially establishing a connection before giving up and * timing out. * @return The updated ClientConfiguration object. */ @SuppressWarnings("checkstyle:hiddenfield") public ClientConfiguration withConnectionTimeout(int connectionTimeout) { setConnectionTimeout(connectionTimeout); return this; }
ClientConfiguration config = new ClientConfiguration(); config.setConnectionTimeout(connectionTimeout); config.setSocketTimeout(readTimeout); AmazonS3 s3 = new AmazonS3Client(credentials, config);
ClientConfiguration config = new ClientConfiguration(); config.setConnectionTimeout(60 * 1000); // 60 sec config.setSocketTimeout(60 * 1000); // 60 sec AmazonS3Client s3Client = new AmazonS3Client(Constants.MANAGER.getCredentials(), config);
private ClientConfiguration createClientConfiguration() { final ClientConfiguration configuration = new ClientConfiguration(); configuration.setConnectionTimeout(6000); configuration.setRequestTimeout(30000); listeners.forEach( c->c.configure( configuration ) ); return configuration; }
static ClientConfiguration s3ClientCfg() { ClientConfiguration cfg = new ClientConfiguration(); Properties prop = System.getProperties(); if (prop.containsKey(S3_SOCKET_TIMEOUT_PROP)) cfg.setSocketTimeout(Integer.getInteger(S3_SOCKET_TIMEOUT_PROP)); if (prop.containsKey(S3_CONNECTION_TIMEOUT_PROP)) cfg.setConnectionTimeout(Integer.getInteger(S3_CONNECTION_TIMEOUT_PROP)); if (prop.containsKey(S3_MAX_ERROR_RETRY_PROP)) cfg.setMaxErrorRetry(Integer.getInteger(S3_MAX_ERROR_RETRY_PROP)); if (prop.containsKey(S3_MAX_HTTP_CONNECTIONS_PROP)) cfg.setMaxConnections(Integer.getInteger(S3_MAX_HTTP_CONNECTIONS_PROP)); if (prop.containsKey(S3_FORCE_HTTP)) cfg.setProtocol(Protocol.HTTP); return cfg; }
private ClientConfiguration createClientConfiguration() { final ClientConfiguration configuration = new ClientConfiguration(); configuration.setConnectionTimeout(60000); configuration.setRequestTimeout(60000); listeners.forEach( c->c.configure( configuration ) ); return configuration; }
private void buildS3Client() { // override default timeout for S3Client ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setConnectionTimeout(SDK_TIME_OUT); clientConfiguration.setSocketTimeout(SDK_TIME_OUT); if (s3Client == null) { s3Client = AmazonS3ClientBuilder.standard() .withCredentials(config.getAwsCredentialsProvider()) .withClientConfiguration(clientConfiguration) .withRegion(config.getS3Region()) .build(); } } private void buildSqsClient() {
public ClientConfiguration getAwsClientConfiguration() { ClientConfiguration config = new ClientConfiguration(); config.setUserAgent(userAgent(config)); config.setMaxConnections(maxConnections()); config.setConnectionTimeout(connectionTimeoutMillis()); config.setSocketTimeout(socketTimeoutMillis()); config.setUseTcpKeepAlive(useTcpKeepAlive()); config.setConnectionTTL(connectionTTLMillis()); config.setUseGzip(useHttpGzip()); return config; }
public AmazonIdentityConfiguration(final Host bookmark, final int timeout) { this.bookmark = bookmark; this.configuration = new ClientConfiguration(); this.configuration.setConnectionTimeout(timeout); this.configuration.setSocketTimeout(timeout); final UseragentProvider ua = new PreferencesUseragentProvider(); this.configuration.setUserAgentPrefix(ua.get()); this.configuration.setMaxErrorRetry(0); this.configuration.setMaxConnections(1); this.configuration.setUseGzip(PreferencesFactory.get().getBoolean("http.compression.enable")); final Proxy proxy = ProxyFactory.get().find(bookmark); switch(proxy.getType()) { case HTTP: case HTTPS: this.configuration.setProxyHost(proxy.getHostname()); this.configuration.setProxyPort(proxy.getPort()); } }
c.setConnectionTimeout(1); assertEquals(c.getConnectionTimeout(), 1);