Builder


class Builder
kotlin.Any
   ↳ android.net.http.QuicOptions.Builder

Builder for QuicOptions.

Summary

Public constructors

Public methods
QuicOptions.Builder

Adds a host to the QUIC allowlist.

QuicOptions

Creates and returns the final QuicOptions instance, based on the values in this builder.

QuicOptions.Builder
setHandshakeUserAgent(handshakeUserAgent: String)

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

QuicOptions.Builder
setIdleConnectionTimeout(idleConnectionTimeout: Duration)

Sets the maximum idle time for a connection.

QuicOptions.Builder
setInMemoryServerConfigsCacheSize(inMemoryServerConfigsCacheSize: Int)

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

Public constructors

Builder

Builder()

Public methods

addAllowedQuicHost

fun addAllowedQuicHost(quicHost: String): QuicOptions.Builder

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.

Parameters
quicHost String: This value cannot be null.
Return
QuicOptions.Builder the builder for chaining This value cannot be null.

build

fun build(): QuicOptions

Creates and returns the final QuicOptions instance, based on the values in this builder.

Return
QuicOptions This value cannot be null.

setHandshakeUserAgent

fun setHandshakeUserAgent(handshakeUserAgent: String): QuicOptions.Builder

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 HttpEngine.Builder#setUserAgent(String) instead.

Parameters
handshakeUserAgent String: This value cannot be null.
Return
QuicOptions.Builder the builder for chaining This value cannot be null.

setIdleConnectionTimeout

fun setIdleConnectionTimeout(idleConnectionTimeout: Duration): QuicOptions.Builder

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 for more details.

Parameters
idleConnectionTimeout Duration: This value cannot be null.
Return
QuicOptions.Builder the builder for chaining This value cannot be null.

setInMemoryServerConfigsCacheSize

fun setInMemoryServerConfigsCacheSize(inMemoryServerConfigsCacheSize: Int): QuicOptions.Builder

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 (HttpEngine.Builder#setStoragePath(String), the HTTP stack will also persist the server configurations on disk.

Return
QuicOptions.Builder the builder for chaining This value cannot be null.