OkHttpTransport

Builds an OkHttpTransport for policy: the system resolver, a fresh client, dispatcher and connection pool. The caller closes it.

Stable Core. Both parameters are required and every number lives in policy.settings; derive a policy with other settings before calling (OutboundUrlPolicy.untrusted { settings { callTimeout = 20.seconds } }).

Return

a new transport.

Parameters

userAgent

the User-Agent sent on every hop: non-blank, visible ASCII (U+0020..U+007E), no leading or trailing space.

policy

the outbound-URL policy whose rules and settings the transport enforces.

Throws

if userAgent breaks its rule, or policy.settings.maxResponseBytes exceeds Int.MAX_VALUE - 8; the message is constant and never echoes a value.