* Attempt at a ConnectionListener
* Fixes
* Test for locks
* Fix for locking
* Add events in RouteFailureTest
* Fixes
* Fixes
* Fixes
* Fast path when None
* Don't defer connectionClosed events
* Don't enqueue connection events
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
* Add a proper Kotlin constructor for Request
This turns out to be very useful throughout our test suite.
* Dump updated API
* Fix multipleTags Kotlin conversion
In a race this could cause us to prefer a new connection over
a pooled connection, which violates our invariant that pooled
connections are always used if they're found.
Closes: https://github.com/square/okhttp/issues/7152
* Move code from RealConnection to RealConnectPlan
Also promote RealConnectPlan to a top-level type, ConnectPlan.
Each RealConnection is now created only once its ready to be used
to carry exchanges. We do the actual connect work in ConnectPlan.
* Move startHttp2() back to RealConnection
* Update FastFallbackExchangeFinder for split RealConnection
* Tests for FastFallbackExchangeFinder
This needed more test facets in TaskFaker.
I'm pretty happy with how the tests read.
* More tests for FastFallbackExchangeFinder.
In order to deterministically test FastFallbackExchangeFinder I need
a test facet that supports several test coordinating:
- the call thread is waiting for either a connection to connect
or for the next-connection timeout (250 ms) to elapse
- the in-flight connection needs to connect
TaskFaker wasn't up to the task for this because it assumed at most
two threads, the test thread and the task thread.
With this change TaskFaker can coordinate multiple task threads
that each run sequentially, as directed by a test thread.
This doesn't yet introduce any mechanism to enable or disable
happy eyeballs.
It also doesn't sort IP addresses to alternate IPv6, IPv4
for best success.
It also doesn't limit how many connections are attempted
simultaneously.
It also lacks an appropriate number of tests.
This is bad because it moves test logic out of tests. But it's also
good because it lowers the cost of writing unit tests with common
types like RealConnection and Route.
I attempted to do a literal translation as much as possible.
Subprojects now need plugins to be configured directly so they
can use the appropriate syntax.