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.
The most awkward part of this is the changes to the way MockResponse
handled chunked encoding. It used to consider trailers a part of its
chunked response; now it does not.
* Handle security exception when checking if conscrypt is preferred.
* Handle security exception when getting the java.specification.version.
* Handle security exception when getting the http.agent property.
* Moved the System.getProperty try-catch block into Utils.
This changes the default from the insecure 1024-bit RSA to a secure 256-bit ECDSA
key. It adds a new option to use RSA keys for interoperating with older clients.
The drawbacks seem small; the callsite needs to handle interruption anyway
because the thread is prone to interruption.
And the upside is that a single interrupt should now be sufficient to break
out an in-flight OkHttp call.
Note that although we're fixing this, thread interruption is not well tested
in OkHttp. Most users should prefer Call.cancel(), which is well tested and
doesn't rely on the caller to know which threads OkHttp is using to make
the actual HTTP request.
Closes: https://github.com/square/okhttp/issues/3945
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.