This changes the executor services in HTTP/2 connection to split up
listener executors (of which there may be many threads) from writer
executors (of which there is one per connection).
This adds a scheduled executor job to send pings on an interval. We
don't yet fail the connection if pongs are not received.
For follow-up there's some work to remove exising APIs to send pings
through the HTTP/2 APIs. These are unused and make it awkard to
confirm that only the automatic pings are being replied to.
See https://github.com/square/okhttp/issues/3261
OkHttpsURLConnection extends javax.net.ssl.HttpsURLConnection.
The super class documentation says that setSSLSocketFactory(null)
throws IllegalArgumentException, but this implementation didn't
do that.
This CL fixed OkHttpsURLConnection.setSSLSocketFactory(null) to
throw, as specified.
Test: not done locally, relying on Travis.
We were prefering to return the networkResponse before the request
had completely failed. Instead we should return the network response
only on failure, and only for APIs that return failed responses.
Some tests hard coded cache entries with OkHttp-Received-Millis
and OkHttp-Sent-Millis headers. Platforms are allowed to have
prefixes other than the default value "OkHttp", which broke
those tests.
These three methods were delegating to delegate; their implementation
was duplicated across both subclasses of DelegatingHttpsURLConnection.
This change moves them into the base class in order to
- avoid duplication
- separate the responsibility of delegation (base class) from the
responsibility of change to behavior (subclasses).
Notes:
- Since these three methods are not available in Java 6, each of
these need a @IgnoreJRERequirement annotation to pass the
animal sniffer test. This appears like it should have been
necessary before but for some reason it used to pass without.
- This in turn requires a new dependency from okhttp-urlconnection
onto animal-sniffer-annotations. The dependency was added onto
version 1.11 of that library (consistent with okhttp itself);
okio depends on version 1.10, the latest version is 1.15.
BridgeInterceptor does some basic header management and implements gzip
on responses.
CacheInterceptor implements HTTP response caching.
ConnectInterceptor takes the StreamAllocation that's already allocated
and uses it to create an HttpStream.
This is an internal class so nobody should see the name. But having a
completely different name will make it much easier to diagnose future
stacktraces because the internal implementation has changed so much
recently.
Also share fewer internal details with the rest of OkHttp. In particular
remove the OkHttp-Selected-Protocol and OkHttp-Response-Source headers
from the core.