Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions) Summary: [Ctors](https://developer.android.com/reference/android/net/http/QuicOptions.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/net/http/QuicOptions.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/http/QuicOptions.Builder#inhmethods)

# QuicOptions.Builder

*** ** * ** ***

` public static final class QuicOptions.Builder `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.http.QuicOptions.Builder |

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/android/net/http/QuicOptions`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/net/http/QuicOptions.Builder#Builder()() ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/net/http/QuicOptions.Builder` | ` https://developer.android.com/reference/android/net/http/QuicOptions.Builder#addAllowedQuicHost(java.lang.String)(https://developer.android.com/reference/java/lang/String quicHost) ` Adds a host to the QUIC allowlist. |
| ` https://developer.android.com/reference/android/net/http/QuicOptions` | ` https://developer.android.com/reference/android/net/http/QuicOptions.Builder#build()() ` Creates and returns the final `https://developer.android.com/reference/android/net/http/QuicOptions` instance, based on the values in this builder. |
| ` https://developer.android.com/reference/android/net/http/QuicOptions.Builder` | ` https://developer.android.com/reference/android/net/http/QuicOptions.Builder#setHandshakeUserAgent(java.lang.String)(https://developer.android.com/reference/java/lang/String handshakeUserAgent) ` Sets the user agent to be used outside of HTTP requests (for example for QUIC handshakes). |
| ` https://developer.android.com/reference/android/net/http/QuicOptions.Builder` | ` https://developer.android.com/reference/android/net/http/QuicOptions.Builder#setIdleConnectionTimeout(java.time.Duration)(https://developer.android.com/reference/java/time/Duration idleConnectionTimeout) ` Sets the maximum idle time for a connection. |
| ` https://developer.android.com/reference/android/net/http/QuicOptions.Builder` | ` https://developer.android.com/reference/android/net/http/QuicOptions.Builder#setInMemoryServerConfigsCacheSize(int)(int inMemoryServerConfigsCacheSize) ` Sets how many server configurations (metadata like list of alt svc, whether QUIC is supported, etc.) should be held in memory. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### Builder

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public Builder ()
```

<br />

<br />

## Public methods

### addAllowedQuicHost

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public QuicOptions.Builder addAllowedQuicHost (String quicHost)
```

Adds a host to the QUIC allowlist.

If no hosts are specified, the per-host allowlist functionality is disabled. Otherwise, the HTTP stack will only use QUIC when talking to hosts on the allowlist.

<br />

| Parameters ||
|---|---|
| `quicHost` | `String`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/QuicOptions.Builder` | the builder for chaining. This value cannot be `null`. <br /> |

### build

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public QuicOptions build ()
```

Creates and returns the final `https://developer.android.com/reference/android/net/http/QuicOptions` instance, based on the values in this builder.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/QuicOptions` | This value cannot be `null`. <br /> |

### setHandshakeUserAgent

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public QuicOptions.Builder setHandshakeUserAgent (String handshakeUserAgent)
```

Sets the user agent to be used outside of HTTP requests (for example for QUIC handshakes).

To set the default user agent for HTTP requests, use `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setUserAgent(java.lang.String)` instead.

<br />

| Parameters ||
|---|---|
| `handshakeUserAgent` | `String`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/QuicOptions.Builder` | the builder for chaining. This value cannot be `null`. <br /> |

### setIdleConnectionTimeout

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public QuicOptions.Builder setIdleConnectionTimeout (Duration idleConnectionTimeout)
```

Sets the maximum idle time for a connection. The actual value for the idle timeout is the minimum of this value and the server's and is negotiated during the handshake. Thus, it only applies after the handshake has completed. If no activity is detected on the connection for the set duration, the connection is closed.

See [RFC 9114, section 5.1](https://www.rfc-editor.org/rfc/rfc9114.html#name-idle-connections) for more details.

<br />

| Parameters ||
|---|---|
| `idleConnectionTimeout` | `Duration`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/QuicOptions.Builder` | the builder for chaining. This value cannot be `null`. <br /> |

### setInMemoryServerConfigsCacheSize

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public QuicOptions.Builder setInMemoryServerConfigsCacheSize (int inMemoryServerConfigsCacheSize)
```

Sets how many server configurations (metadata like list of alt svc, whether QUIC is supported, etc.) should be held in memory.

If the storage path is set (`https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setStoragePath(java.lang.String)`, the HTTP stack will also persist the server configurations on disk.

<br />

| Parameters ||
|---|---|
| `inMemoryServerConfigsCacheSize` | `int` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/QuicOptions.Builder` | the builder for chaining. This value cannot be `null`. <br /> |