Square's meticulous HTTP client for Java and Kotlin
—
Connection pooling, dispatching, and network configuration for optimal performance.
Manages HTTP and HTTPS connections for reuse to reduce latency.
class ConnectionPool(
maxIdleConnections: Int = 5,
keepAliveDuration: Long = 5,
timeUnit: TimeUnit = TimeUnit.MINUTES
) {
constructor(maxIdleConnections: Int, keepAliveDuration: Duration)
fun idleConnectionCount(): Int
fun connectionCount(): Int
fun evictAll()
}Policy for request execution, including maximum concurrent requests.
class Dispatcher {
constructor()
constructor(executorService: ExecutorService)
var maxRequests: Int
var maxRequestsPerHost: Int
var idleCallback: Runnable?
val executorService: ExecutorService
fun cancelAll()
fun runningCallsCount(): Int
fun queuedCallsCount(): Int
fun runningCalls(): List<Call>
fun queuedCalls(): List<Call>
}Install with Tessl CLI
npx tessl i tessl/maven-com-squareup-okhttp3--okhttp