static ConnectionSettings createConnectionSettings(Configuration conf) {

    int maxConnections = S3AUtils.intOption(conf, MAXIMUM_CONNECTIONS,
        DEFAULT_MAXIMUM_CONNECTIONS, 1);

    final boolean keepAlive = conf.getBoolean(CONNECTION_KEEPALIVE,
        DEFAULT_CONNECTION_KEEPALIVE);

    // time to acquire a connection from the pool
    Duration acquisitionTimeout = getDuration(conf, CONNECTION_ACQUISITION_TIMEOUT,
        DEFAULT_CONNECTION_ACQUISITION_TIMEOUT_DURATION, TimeUnit.MILLISECONDS,
        minimumOperationDuration);

    // set the connection TTL irrespective of whether the connection is in use or not.
    // this can balance requests over different S3 servers, and avoid failed
    // connections. See HADOOP-18845.
    Duration connectionTTL = getDuration(conf, CONNECTION_TTL,
        DEFAULT_CONNECTION_TTL_DURATION, TimeUnit.MILLISECONDS,
        null);

    Duration establishTimeout = getDuration(conf, ESTABLISH_TIMEOUT,
        DEFAULT_ESTABLISH_TIMEOUT_DURATION, TimeUnit.MILLISECONDS,
        minimumOperationDuration);

    // limit on the time a connection can be idle in the pool
    Duration maxIdleTime = getDuration(conf, CONNECTION_IDLE_TIME,
        DEFAULT_CONNECTION_IDLE_TIME_DURATION, TimeUnit.MILLISECONDS, Duration.ZERO);

    Duration socketTimeout = getDuration(conf, SOCKET_TIMEOUT,
        DEFAULT_SOCKET_TIMEOUT_DURATION, TimeUnit.MILLISECONDS,
        minimumOperationDuration);

    return new ConnectionSettings(
        maxConnections,
        keepAlive,
        acquisitionTimeout,
        connectionTTL,
        establishTimeout,
        maxIdleTime,
        socketTimeout);
  }
@Test
  public void testMinimumDurationWins() {

    final Configuration conf = conf();
    setOptionsToValue("1s", conf,
        CONNECTION_ACQUISITION_TIMEOUT,
        CONNECTION_TTL,
        CONNECTION_IDLE_TIME,
        ESTABLISH_TIMEOUT,
        SOCKET_TIMEOUT);
    final AWSClientConfig.ConnectionSettings conn = createConnectionSettings(conf);
    LOG.info("Connection settings: {}", conn);
    assertDuration(CONNECTION_ACQUISITION_TIMEOUT, MINIMUM_NETWORK_OPERATION_DURATION,
        conn.getAcquisitionTimeout());

    assertDuration(ESTABLISH_TIMEOUT, MINIMUM_NETWORK_OPERATION_DURATION,
        conn.getEstablishTimeout());
    assertDuration(SOCKET_TIMEOUT, MINIMUM_NETWORK_OPERATION_DURATION,
        conn.getSocketTimeout());

    // those options with a minimum of zero
    final Duration s1 = Duration.ofSeconds(1);
    assertDuration(CONNECTION_TTL, s1, conn.getConnectionTTL());
    assertDuration(CONNECTION_IDLE_TIME, s1, conn.getMaxIdleTime());
  }