* Prepare to enable Spotless
I'm not super keen on any of these changes, but I am very
keen on having automatic formatting.
* Don't actually enable Spotless yet
Just hard-coding 'localhost' is simpler and avoids problems where
the host machine's IP address has additional DNS registrations.
Closes: https://github.com/square/okhttp/issues/7603
* 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
This is a source-incompatible API change. In particular, Response.body(null)
is no longer source-compatible for Kotlin source.
The upside is tremendous: no need for callers to use !! on Response.body
on every single API call. In the rare cases where a Response doesn't have
a body we use a runtime error. This is unlikely to cause problems in
practice; users don't have reason to read the response body on supporting
responses.
The new ktlint sorts imports which makes this diff large.
The new japicmp ignores 'final' modifier changes in final classes.
We adopt the Google style for checkstyle.xml.
Okio readByteString() now uses segments more aggressively, so we
need to mitigate that to avoid tracking those segments in a test.
These replace requestBodyEnd() / responseBodyEnd() in some failure scenarios.
They may also be issued in cases where no event was published previously.
* onFailure callback's exception type widened to Throwable. This allows runtime exceptions from other callbacks to be passed along.
* Ensure the connection is closed properly for all failures.
* Fix and document the threading inside RealWebSocket. This ensures the listener is always called on the same thread and replies always happen from the correct thread.
Shutdown the executor upon close or failure. This avoids the program
hanging after finished the execution.
Set the client read timeout to 0 (the default timeout is 10s). A read
timeout doesn't make sense for a WebSocket.