* Fix a flake in TrailersTest
We weren't testing what we wanted to be testing because
the cache was on, and that impacts how Response.body.close()
works.
* Fix HTTP/1 also
* Spotless
---------
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
* Call.addEventListener
Use this to install listeners after-the-fact, such as
in Interceptors or other EventListeners.
* apiDump
* Make eventListener updates atomic
* Fix
The first half is EventListenerAdapter, which mechanically
converts event function calls and emits event objects.
The second half is EventRecorder, which validates that the
right events are published.
This is in preparation for a follow-up where I intend
to dynamically add EventListeners to a Call.
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
* Run all the tests in CI
We haven't been. I would have expected ./gradlew test
to run everything, but it doesn't. We need to explicitly
run jvmTest to get all of our tests to run.
* Use allTests, not jvmTest
* Support Corretto on osx-aarch_64
* Handle the exception message from OpenJDK 21
* Fixup Loom tests
---------
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
* Read RequestBody before Connection Upgrade
* Be more strict on event lifecycle for upgrades (#9170)
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
---------
Co-authored-by: Jesse Wilson <jesse@swank.ca>
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
Originally I was planning on implementing tags on
Request only, but that design broke as soon as any
interceptor used Request.newBuilder() to create a
copy of the Request - the instance that received the
tags might not be the instance that needed them.
Instead I'm introducing this behavior on the Call
object, which behaves less like a value. I expect
that users' expected lifetimes of tags will work
naturally this way.
It is an API hazard that we have tags on both
Requests and Calls. Perhaps if given the opportunity
to do it over, I'd omit support for tags on Requests.
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
* New datastructure to hold Tags
We have been using MutableMap and Map. These have worked
fine.
But we'd like to soon support mutating tags on an existing
Request object, which I'd like to do without a ton of
collections or concurrency overhead. Instead we can do some
lock-free stuff, which needs a simple data structure as a
starting point.
* Fill in some type parameters
* Update junit configuration in renovate.json
avoid major updates
* Add monorepo and recommended groups to Renovate config
* Remove groupName from junit-framework configuration
Removed groupName for junit-framework monorepo.
* Update Renovate config by removing ignored dependencies
Removed ignored dependencies from Renovate configuration.
* Update Renovate configuration to use junit5
* Make tests fail on UnsupportedOperationException
Will fail without the okio fix.
```
09:14:49.703 E FATAL EXCEPTION: MockWebServer TaskRunner (Ask Gemini)
Process: okhttp.android.test.test, PID: 10087
java.lang.UnsupportedOperationException
at javax.net.ssl.SSLSocket.shutdownOutput(SSLSocket.java:851)
at okio.internal.DefaultSocket$SocketSink.close(DefaultSocket.kt:95)
at okio.ForwardingSink.close(ForwardingSink.kt:37)
at mockwebserver3.internal.MockWebServerSocket$sink$1.close(MockWebServerSocket.kt:69)
at okio.RealBufferedSink.close(RealBufferedSink.kt:287)
at okhttp3.internal.http2.Http2Writer.close(Http2Writer.kt:331)
at okhttp3.internal.http2.Http2Connection.close$okhttp(Http2Connection.kt:474)
at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:638)
at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:619)
at okhttp3.internal.concurrent.TaskQueue$execute$1.runOnce(TaskQueue.kt:112)
at okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:81)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
```
* cleanup
* Fix SSL Handshake issue affecting MockWebserver on Android 24
Only called in MWS, but fails on API 24 when called. Adds a single Junit 4 test to run on Android 21-24.
Add a test since Junit 5 wasn't running on older devices.
* fix version number
* reformat
* reformat
There's only one implementation in use, and so I'm
inlining it to call through what it ultimately does.
My motivation is to avoid retaining a reference to an
EventListener anywhere, because that value is going
from immutable to mutable.
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
It's currently unused.
I'd like to bring this feature back soon, but using
regular Calls to make it happen rather than having
Connections created without a Call object. That should
avoid some special cases.
Co-authored-by: Jesse Wilson <jwilson@squareup.com>