* Lookup the FQDN given the MockWebServer hostname to compare with the HttpUrl hostname. Issue #3546.
* Update MockWebServer to use the FQDN for its host name. Issue #3546.
This was fixed recently but we didn't update the corresponding test case. This
updates the test and adds a few more to confirm that HTTP/2 failure recovery
works as it should.
Closes: https://github.com/square/okhttp/issues/578
This changes RealWebSocket from using a shared ThreadPoolExecutor to
using a private ScheduledExecutorService. This make some of the code
simpler but it means that applications will hold 1 writer thread for
each websocket, even if it is mostly not writing.
Testing automatic pings is awkward. This refactors much of
RealWebSocketTest to make it more natural to reinitialize the
configuration.
Closes: https://github.com/square/okhttp/issues/2993
Rather than immediately and violently closing the HTTP/2 stream,
we initiate the shutdown sequence for a graceful disconnect.
This fixes StreamAllocation to avoid creating new streams on
shutdown connections. That behavior is not well tested, however.
That will come by integrating dave-r12's PR:
See https://github.com/square/okhttp/pull/2889
* 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.
Also rename HttpStream to HttpCodec. This is the interface implemented
for both HTTP/1.1 and HTTP/2. The HTTP/2 codec creates a stream when
it is used.
These are currently being encoded in UTF-8, and the charset is not
otherwise specified, so the result is not necessarily going to
succeed at caching.
But this avoids crashing when the server returns an unexpected ETag.
Closes: https://github.com/square/okhttp/issues/2628
MockWebServer.readRequest() was accumulating the request body (1 GByte)
into an unbounded buffer held in memory. This caused the test to fail
with an OutOfMemoryError on low-memory devices. Due to the OOME, not
even a stacktrace was available.
This CL introduces setBodyLimit() to limit the amount of data held in
memory. Note that this is similar to the call to setBodyLimit(0) that
already exists in URLConnectionTest.veryLargeFixedLengthRequest().