I'm not particularly happy with all of the moving parts here. I think
perhaps doing web sockets over duplex is a possible fix here.
Closes: https://github.com/square/okhttp/issues/4658
This will help prevent regressions and point to the leaking test, rather than to a later test that happens to checks for leaks. The change is applied to all tests that have an OkHttpClient member variable.
Some OkHttp behavior was only tested via this API, so this PR includes a bunch
of test migration. The test migration is as mechanical as possible, so we aren't
really using idiomatic APIs yet in these tests.
The `okhttp-urlconnection` survives for the JavaNetCookieJar and the
JavaNetAuthenticator. We can't remove these any time soon unfortunately.
I'm not particularly happy with the way this code looks, but I like
the result. Otherwise exceptions are like these:
* stream was reset: CANCEL
* Socket closed
* Canceled
These replace requestBodyEnd() / responseBodyEnd() in some failure scenarios.
They may also be issued in cases where no event was published previously.
This is the payoff that preceding changes have been working towards.
This splits StreamAllocation into three parts:
- ExchangeFinder: strategy to allocate connections for exchanges
- Exchange: a single request/response pair
- Transmitter: a sequence of exchanges for a Call
The refactoring isn't totally complete, but this should be the last
big one.
https://github.com/square/okhttp/issues/4603
Today we have to suppress 'connectionAcquired' events because we attach the
constructed connection and then replace it with the pooled one. This changes
the logic to use separate fields for the connecting connection vs. the
pooled one.
This changes failure recovery to only attempt when the failure
occurs when OkHttp is doing I/O. If a failure is triggered by
something else (such as a bad RequestBody or Interceptor) then
that failure will not be retried.
https://github.com/square/okhttp/issues/4603
This creates a new class ResponseBodySource that manages events and
connections. It's symmetric with our existing RequestBodySink class.
Continuing to work towards these things having their own lifecycles
that are separate from HTTP framing mechanics.
https://github.com/square/okhttp/issues/4603
Our 'Internal' trampoline really gets in the way with this one. Just
move the actual implementation code into its own type so there isn't
as much indirection.
Unfortunately we can't easily make RealConnectionPool extend from
ConnectionPool because otherwise we'd be open to any user-provided
connection pools and our API isn't that complete yet.
This is a mechanical refactoring that changes all code that directly
accesses a StreamAllocation to instead access a Transmitter. The
next step is to combine StreamAllocation and Transmitter into
a single class.
* Build with 3 targets
* Update maven
* remove jdk 12 ea
* Try without errorprone temporarily
* Still set 1.8
* javadoc tolerance
* Profiles for 10 + 11
* More tolerant
* JDK 11 test skipping
* Cleanup imports
* Link to github issues
* Support JDK 12 building
* Dispatcher#promoteAndExecute is no longer quadratic
* Maintain map internally
* Factor out two deques to RunningCall class
* Checkstyle
* Revert map-based implementation
* RealCall tracks calls per host using an AtomicInteger
* Loop through both ready and queued
* Empty commit for CI