OkHttp - 现代应用网络的方式

官网:Overview - OkHttp

HTTP is the way modern applications network. It's how we exchange data & media. Doing HTTP efficiently makes your stuff load faster and saves bandwidth.

OkHttp is an HTTP client that's efficient by default:

  • HTTP/2 support allows all requests to the same host to share a socket.
  • Connection pooling reduces request latency (if HTTP/2 isn't available).
  • Transparent GZIP shrinks download sizes.
  • Response caching avoids the network completely for repeat requests.

OkHttp perseveres when the network is troublesome: it will silently recover from common connection problems. If your service has multiple IP addresses, OkHttp will attempt alternate addresses if the first connect fails. This is necessary for IPv4+IPv6 and services hosted in redundant data centers. OkHttp supports modern TLS features (TLS 1.3, ALPN, certificate pinning). It can be configured to fall back for broad connectivity.

Using OkHttp is easy. Its request/response API is designed with fluent builders and immutability. It supports both synchronous blocking calls and async calls with callbacks.

相关推荐
溜达的大象34 分钟前
管家婆远程访问实战:SQL Server 2022配置、PC分机端修改与固定TCP连接
网络·网络协议·tcp/ip
\光辉岁月/1 小时前
15.JavaSE-网络
java·开发语言·网络
星恒讯工业路由器1 小时前
5G RedCap、eRedCap与LTE Cat-1bis:中低速物联网的“三国杀“与选型指南
网络·智能路由器·工业路由器·工业物联网·5g redcap·lte cat-1bis·eredcap
艾芯微科技1 小时前
ETA1637S2G|钰泰同步升压 LED 背光驱动 SOT23-6,0.1% 超低占空比 PWM 调光
网络·单片机·嵌入式硬件·集成测试·51单片机
JosieBook2 小时前
【多线程】两台机器同时抢一个字典:一次并发 Bug 的排查
java·网络·bug
Multipath7122 小时前
以多链路聚合为通信底座,让低空飞行器“连得上、传得快、飞得稳、管得住”
网络·5g·安全·智能路由器·实时音视频
pt10432 小时前
Cisco设备网络安全系列-4:分层网络安全基础设施案例与核心技术
网络·安全
Fu2067212 小时前
网络基本配置
网络
艾芯微科技3 小时前
CJX3134K 长晶双 N 沟道 MOS 管详解|SOT-563 20V 小型电源开关方案
网络·单片机·嵌入式硬件·集成测试·51单片机
白帽攻防录3 小时前
SRC 挖洞:QUIC 协议栈双 RCE,HTTP/3 的新攻击面怎么挖
网络·网络协议·http·网络安全·http/3