public static class**QuicOptions.Builder** extends Object  
Builder for[QuicOptions](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.html).  

### Public Method Summary

|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [addAllowedQuicHost](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#addAllowedQuicHost(java.lang.String))(String quicHost) Adds a host to the QUIC allowlist.                                                                                                                                                                                                |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [addClientConnectionOption](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#addClientConnectionOption(java.lang.String))(String clientConnectionOption) Adds a QUIC tag to send in a QUIC handshake's connection options that only affects the client.                                                                                                        |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [addConnectionOption](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#addConnectionOption(java.lang.String))(String connectionOption) Adds a QUIC tag to send in a QUIC handshake's connection options.                                                                                                                                                       |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [addEnabledQuicVersion](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#addEnabledQuicVersion(java.lang.String))(String enabledQuicVersion) Adds a QUIC version to the list of QUIC versions to enable.                                                                                                                                                       |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [addExtraQuicheFlag](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#addExtraQuicheFlag(java.lang.String))(String extraQuicheFlag) Sets an arbitrary QUICHE flag.                                                                                                                                                                                             |
| [QuicOptions](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.html)                 | [build](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#build())() Creates and returns the final[QuicOptions](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.html)instance, based on the values in this builder.                                                                                            |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [closeSessionsOnIpChange](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#closeSessionsOnIpChange(boolean))(boolean closeSessionsOnIpChange) Sets whether QUIC sessions should be closed on IP address change.                                                                                                                                                |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [delayJobsWithAvailableSpdySession](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#delayJobsWithAvailableSpdySession(boolean))(boolean delayJobsWithAvailableSpdySession) Sets whether Cronet should wait for the primary path (usually QUIC) to be ready even if there's a secondary path of reaching the server (SPDY / HTTP2) which is ready immediately. |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [enableTlsZeroRtt](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#enableTlsZeroRtt(boolean))(boolean enableTlsZeroRtt) Sets whether TLS with 0-RTT should be enabled.                                                                                                                                                                                        |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [goawaySessionsOnIpChange](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#goawaySessionsOnIpChange(boolean))(boolean goawaySessionsOnIpChange) Sets whether QUIC sessions should be goaway'd on IP address change.                                                                                                                                           |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [increaseBrokenServicePeriodExponentially](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#increaseBrokenServicePeriodExponentially(boolean))(boolean increaseBrokenServicePeriodExponentially) Sets whether the broken server period should scale exponentially.                                                                                             |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [retryWithoutAltSvcOnQuicErrors](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#retryWithoutAltSvcOnQuicErrors(boolean))(boolean retryWithoutAltSvcOnQuicErrors) Sets whether requests that failed with a QUIC protocol errors should be retried without using any`alt-svc`servers.                                                                          |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [setCryptoHandshakeTimeoutSeconds](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#setCryptoHandshakeTimeoutSeconds(long))(long cryptoHandshakeTimeoutSeconds) Sets the timeout for a connection SSL handshake.                                                                                                                                               |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [setHandshakeUserAgent](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#setHandshakeUserAgent(java.lang.String))(String handshakeUserAgent) Sets the user agent to be used outside of HTTP requests (for example for QUIC handshakes).                                                                                                                        |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [setIdleConnectionTimeoutSeconds](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#setIdleConnectionTimeoutSeconds(long))(long idleConnectionTimeoutSeconds) Sets the maximum idle time for a connection.                                                                                                                                                      |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [setInMemoryServerConfigsCacheSize](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#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.                                                                |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [setInitialBrokenServicePeriodSeconds](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#setInitialBrokenServicePeriodSeconds(long))(long initialBrokenServicePeriodSeconds) Sets the initial for which Cronet shouldn't attempt to use QUIC for a given server after the server's QUIC support turned out to be broken.                                        |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [setPreCryptoHandshakeIdleTimeoutSeconds](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#setPreCryptoHandshakeIdleTimeoutSeconds(long))(long preCryptoHandshakeIdleTimeoutSeconds) Sets the maximum idle time for a connection which hasn't completed a SSL handshake yet.                                                                                   |
| [QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html) | [setRetransmittableOnWireTimeoutMillis](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#setRetransmittableOnWireTimeoutMillis(long))(long retransmittableOnWireTimeoutMillis) Sets the maximum desired time between packets on wire.                                                                                                                          |

### Inherited Method Summary

From class java.lang.Object  

|------------------|---------------------------|
| Object           | clone()                   |
| boolean          | equals(Object arg0)       |
| void             | finalize()                |
| final Class\<?\> | getClass()                |
| int              | hashCode()                |
| final void       | notify()                  |
| final void       | notifyAll()               |
| String           | toString()                |
| final void       | wait(long arg0, int arg1) |
| final void       | wait(long arg0)           |
| final void       | wait()                    |

## Public Methods

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**addAllowedQuicHost**(String quicHost)

Adds a host to the QUIC allowlist.

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

##### Parameters

| quicHost |   |
|----------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**addClientConnectionOption**(String clientConnectionOption)

Adds a QUIC tag to send in a QUIC handshake's connection options that only affects the client.

See[addConnectionOption(String)](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#addConnectionOption(java.lang.String))for more details.  

##### Parameters

| clientConnectionOption |   |
|------------------------|---|

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**addConnectionOption**(String connectionOption)

Adds a QUIC tag to send in a QUIC handshake's connection options.

The QUIC tags should be presented as strings up to four letters long (for instance,`NBHD`).

As the QUIC tags are under active development and some are only relevant to the server, Cronet doesn't attempt to maintain a complete list of all supported QUIC flags as a part of the API. The flags. Flags supported by QUICHE, a QUIC implementation used by Cronet and Google servers, can be found[here](https://github.com/google/quiche/blob/main/quiche/quic/core/crypto/crypto_protocol.h").  

##### Parameters

| connectionOption |   |
|------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**addEnabledQuicVersion**(String enabledQuicVersion)

Adds a QUIC version to the list of QUIC versions to enable.

If no versions are specified, Cronet will use a list of default QUIC versions.

The version format is specified by[QUICHE](https://github.com/google/quiche/blob/main/quiche/quic/core/quic_versions.cc#L344). Outside of filtering out values known to be obsolete, Cronet doesn't process the versions anyhow and simply passes them along to QUICHE.  

##### Parameters

| enabledQuicVersion |   |
|--------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**addExtraQuicheFlag**(String extraQuicheFlag)

Sets an arbitrary QUICHE flag. Flags should be passed in`FLAG_NAME=FLAG_VALUE`format. See the[QUICHE code base](https://github.com/google/quiche/)for a full list of flags.  

##### Parameters

| extraQuicheFlag |   |
|-----------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.html)**build**()

Creates and returns the final[QuicOptions](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.html)instance, based on the values in this builder.  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**closeSessionsOnIpChange**(boolean closeSessionsOnIpChange)

Sets whether QUIC sessions should be closed on IP address change.

Don't use in combination with connection migration (configured using[ConnectionMigrationOptions](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/ConnectionMigrationOptions.html)).  

##### Parameters

| closeSessionsOnIpChange |   |
|-------------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**delayJobsWithAvailableSpdySession**(boolean delayJobsWithAvailableSpdySession)

Sets whether Cronet should wait for the primary path (usually QUIC) to be ready even if there's a secondary path of reaching the server (SPDY / HTTP2) which is ready immediately.  

##### Parameters

| delayJobsWithAvailableSpdySession |   |
|-----------------------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**enableTlsZeroRtt**(boolean enableTlsZeroRtt)

Sets whether TLS with 0-RTT should be enabled.

0-RTT is a performance optimization avoiding an extra round trip when resuming connections to a known server.  

##### Parameters

| enableTlsZeroRtt |   |
|------------------|---|

##### Returns

- the builder for chaining  

##### See Also

- [Cloudflare's 0-RTT blogpost](https://blog.cloudflare.com/introducing-0-rtt/)  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**goawaySessionsOnIpChange**(boolean goawaySessionsOnIpChange)

Sets whether QUIC sessions should be goaway'd on IP address change.

Don't use in combination with connection migration (configured using[ConnectionMigrationOptions](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/ConnectionMigrationOptions.html)).  

##### Parameters

| goawaySessionsOnIpChange |   |
|--------------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**increaseBrokenServicePeriodExponentially**(boolean increaseBrokenServicePeriodExponentially)

Sets whether the broken server period should scale exponentially.

If set to true, the initial delay (configurable by[setInitialBrokenServicePeriodSeconds(long)](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#setInitialBrokenServicePeriodSeconds(long))) will be scaled exponentially for subsequent retries (`SCALING_FACTOR^NUM_TRIES * delay`). If false, the delay will scale linearly (SCALING_FACTOR \* NUM_TRIES \* delay).  

##### Parameters

| increaseBrokenServicePeriodExponentially |   |
|------------------------------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**retryWithoutAltSvcOnQuicErrors**(boolean retryWithoutAltSvcOnQuicErrors)

Sets whether requests that failed with a QUIC protocol errors should be retried without using any`alt-svc`servers.  

##### Parameters

| retryWithoutAltSvcOnQuicErrors |   |
|--------------------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**setCryptoHandshakeTimeoutSeconds**(long cryptoHandshakeTimeoutSeconds)

Sets the timeout for a connection SSL handshake.  

##### Parameters

| cryptoHandshakeTimeoutSeconds |   |
|-------------------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**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[CronetEngine.Builder.setUserAgent(String)](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/CronetEngine.Builder.html#setUserAgent(java.lang.String))instead.  

##### Parameters

| handshakeUserAgent |   |
|--------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**setIdleConnectionTimeoutSeconds**(long idleConnectionTimeoutSeconds)

Sets the maximum idle time for a connection. TODO what happens to connection that are idle for too long?  

##### Parameters

| idleConnectionTimeoutSeconds |   |
|------------------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**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 ([CronetEngine.Builder.setStoragePath(String)](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/CronetEngine.Builder.html#setStoragePath(java.lang.String)), Cronet will also persist the server configurations on disk.  

##### Parameters

| inMemoryServerConfigsCacheSize |   |
|--------------------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**setInitialBrokenServicePeriodSeconds**(long initialBrokenServicePeriodSeconds)

Sets the initial for which Cronet shouldn't attempt to use QUIC for a given server after the server's QUIC support turned out to be broken.

Once Cronet detects that a server advertises QUIC but doesn't actually speak it, it marks the server as broken and doesn't attempt to use QUIC when talking to the server for an amount of time. Once Cronet is past this point it will try using QUIC again. This is to balance short term (there's no point wasting resources to try QUIC if the server is broken) and long term (the breakage might have been temporary, using QUIC is generally beneficial) interests.

The delay is increased every unsuccessful consecutive retry. See[increaseBrokenServicePeriodExponentially(boolean)](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html#increaseBrokenServicePeriodExponentially(boolean))for details.  

##### Parameters

| initialBrokenServicePeriodSeconds |   |
|-----------------------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**setPreCryptoHandshakeIdleTimeoutSeconds**(long preCryptoHandshakeIdleTimeoutSeconds)

Sets the maximum idle time for a connection which hasn't completed a SSL handshake yet.  

##### Parameters

| preCryptoHandshakeIdleTimeoutSeconds |   |
|--------------------------------------|---|

##### Returns

- the builder for chaining  

#### public[QuicOptions.Builder](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/QuicOptions.Builder.html)**setRetransmittableOnWireTimeoutMillis**(long retransmittableOnWireTimeoutMillis)

Sets the maximum desired time between packets on wire.

When the retransmittable-on-wire time is exceeded Cronet will probe quality of the network using artificial traffic. Smaller timeouts will typically result in faster discovery of a broken or degrading path, but also larger usage of resources (battery, data).  

##### Parameters

| retransmittableOnWireTimeoutMillis |   |
|------------------------------------|---|

##### Returns

- the builder for chaining