$ show lysine-dev/okhttp
OkHttp is a production-grade HTTP client library for JVM and Android, supporting HTTP/1.1, HTTP/2, WebSockets, Server-Sent Events, TLS/SSL, DNS over HTTPS, content compression (gzip, brotli, zstd), caching, cookies, and authentication. It is designed for efficiency with connection pooling, multiplexing, and async execution. The architecture is a multi-module Kotlin/Gradle project with a core library (okhttp) and optional extensions (brotli, zstd, sse, coroutines, logging, DNS over HTTPS, TLS utilities). It uses an interceptor chain pattern for request/response processing, with application interceptors and network interceptors. Platform abstraction handles JVM vs Android differences for TLS, DNS, and sockets. Key entry points include OkHttpClient, Request, Response, Call, Interceptor, EventListener, WebSocket, and EventSource. External dependencies include Okio (I/O library), Kotlin stdlib, and optional TLS providers (Conscrypt, BouncyCastle, OpenJSSE). The library is extensively tested with unit tests, integration tests, and Android device tests.
The LLM identified 5 files worth highlighting for reuse:
A generic, thread-safe LRU cache with configurable maximum size and time-to-live. It supports put, get, remove, and eviction of expired entries. The implementation is clean and could be extracted for use in any caching scenario.
An immutable, copy-on-write key-value store designed for attaching metadata to HTTP calls. It provides thread-safe access and supports merging. The design is simple and reusable for any context requiring immutable tags.
An immutable cookie class with a builder for constructing cookies from name-value pairs and attributes. It includes validation, domain matching, and expiry handling. The implementation is RFC 6265 compliant and could be extracted as a standalone cookie parser.
A complete HPACK (RFC 7541) encoder and decoder with static and dynamic tables, Huffman coding, and integer encoding. It is used internally for HTTP/2 header compression but could be extracted as a standalone library for HPACK manipulation.
An in-memory socket implementation that simulates network connections with a state machine (New, Connecting, Connected, Closed). It supports graceful and canceled close semantics, and can be layered with TLS. This enables deterministic testing of connection logic without real I/O.