okhttp
okhttp copied to clipboard
Add a socket abstraction
What
This PR adds a bunch of abstractions over Socket
and related factories. We named the abstraction classes things like OkioSocket
which telegraphs our intent to eventually upstream these into Okio. For now they'll just live in okhttp3.internal
.
Why
This is the first step toward making our test infrastructure better. This will allow us to create fake sockets that integrate with TaskFaker which yield on read/write so that other tasks can get a shot.
As a motivating use case, this will allow us to fix the flaky ConnectPoolTest.connectionPreWarmingHttp2
.
What's next
- Implement a bunch of fakes that play nicely with
TaskFaker
and use them inMockHttp2Peer
,MockWebServer
, etc - Maybe: Use composition instead of inheritance in
OkioSslSocket