1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-24 18:41:06 +03:00
Commit Graph

102 Commits

Author SHA1 Message Date
Jesse Wilson
5917d7a083 Add a way for MockWebServer to track truncated requests
It now tracks inbound requests that fail with an IOException.

Also add a fix for the bug where we'd send 'END OF STREAM' on a stream
that we'd previously canceled, which raced with the 'RST STREAM' and led
to flakiness.

Before we ship the new API in RecordedRequest we should go over the
other cases where inbound HTTP requests fail and make sure they
get reported through this channel.

Closes: https://github.com/square/okhttp/issues/5388
2019-10-05 21:50:00 -04:00
Jesse Wilson
aad8a1420d Name tasks only in TaskRunner (#5526)
* Name tasks only in TaskRunner

Naming queues seemed good initially, but the names are mostly
mutually-redundant with task names.

This PR reduces debug information when a queue is still busy
when the test completes. I have a fix for that in a follow-up
change.

* Update okhttp/src/main/java/okhttp3/internal/ws/RealWebSocket.kt

Co-Authored-By: Yuri Schimke <yuri@schimke.ee>
2019-10-02 22:38:24 -04:00
Jesse Wilson
9849ab8e3b Create OkHttpClient instances eagerly in tests
We used to do this lazily because OkHttpClient instances were
somewhat heavy: each standalone instance held its own
ExecutorService for the connection pool.

Now that we have TaskRunner each instance is much more
lightweight and the drawbacks of creating instances eagerly
is negligible.
2019-09-28 20:53:12 -04:00
Jesse Wilson
fe40324a4b TaskRunner support for shutting down queues
Shutting down queues makes it easier to implement HTTP/2
shutdown because we can enqueue everywhere and centralize
the logic that decides whether we're shutdown or not.

Use this new functionality to implement HTTP/2 on task queues.
It's mostly a drop-in replacement, though opting-into cancel
looks like a mistake when it's what we do most of the time.

When testing this the OkHttpClientTestRule was failing because
tasks were incomplete. I was puzzled by this until I realized
that the OkHttpClientTestRule performs that validation before
we stop the MockWebServer. I changed MockWebServer to have its
own TaskRunner and that made the problem go away.
2019-09-26 21:12:40 -04:00
Jesse Wilson
bc3ad111ad Adopt TaskRunner in RealConnectionPool
This also configures tests to assert that the connection pool
isn't doing any work after the test completes.
2019-09-26 08:16:50 -04:00
Yuri Schimke
7cf508a30b OpenJSSE Platform support (#5369)
Adds support for OpenJSSE when registered as the first security provider.
2019-08-18 12:03:51 +03:00
Yuri Schimke
1b60e3739c Test Android session reuse 2019-08-11 10:48:43 +01:00
Yuri Schimke
2a1f328d58 Add proxy event logging (#5300) 2019-07-25 05:42:32 +01:00
Yuri Schimke
2c7811a64a Move flaky issues to comments (#5289) 2019-07-16 22:50:51 +01:00
Yuri Schimke
a6c4ff6e44 Output client events after tagged @Flaky tests or failures (#5217)
Collect additional debugging info for know problem tests or after unplanned failures.
2019-07-16 22:34:32 +01:00
Yuri Schimke
16b7e36968 Fix for conscrypt tests (#5263) 2019-07-03 07:20:28 +01:00
Yuri Schimke
bdd6c3944f Testing with JDK 12 and latest 11.0.3 (#5212)
JDK 12 and be more specific about when we expect failures, e.g. 11.0.3 has fixes we should take into account.
2019-07-02 07:21:58 +01:00
Yuri Schimke
d81ec0f23b OkHttpClientTestRule check connectionCount instead of idle (#5226)
* OkHttpClientTestRule check connectionCount instead of idle

Clients should be clean after use, not just from idle connections.

* Abandon unclean clients

* Simplify logic
2019-06-25 22:34:51 -07:00
Jesse Wilson
ad5d6b8a7b Make OkHttpClientTestRule more powerful.
I'm hoping to follow this up with a change so that this rule can also do the
uncaught exception handling that we're currently doing elsewhere.

See https://github.com/square/okhttp/issues/4894
2019-06-15 22:08:18 -04:00
Amir Livneh
8deaef6702 Fix race condition in RecordingHostnameVerifier
When connections are established concurrently, verify() sometimes throws a `java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 0` because of unsynchronized access to the `calls` list.
2019-04-23 10:19:22 -07:00
Yuri Schimke
f3949c23bc Spotless code formatter 2019-04-10 22:44:58 +01:00
Yuri Schimke
9e12bc4d60 Improve PlatformRule autodetection (#4920)
Run more platforms in circleci.
Auto detect platform in IDE.
Surface more platform assumptions in tests.
2019-04-10 19:31:35 +01:00
TangHuaiZhe
a7603602ca add @overide for subclass override method 2019-03-30 12:46:18 +08:00
Jesse Wilson
dc1e870d24 Basic Gradle support 2019-03-17 00:16:26 -04:00
Jesse Wilson
dedc6ecd5b Use more AssertJ features 2019-03-14 17:57:42 -04:00
Jesse Wilson
695b46cb2e [maven-release-plugin] prepare for next development iteration 2019-03-13 23:42:40 -04:00
Jesse Wilson
44d51d0ceb [maven-release-plugin] prepare release parent-3.14.0 2019-03-13 23:42:33 -04:00
Benoît Quenaudon
6c4855a7c7 Use AssertJ in tests (#4713) 2019-03-13 21:07:33 -04:00
Amir Livneh
018510fa40 Rename OkHttpClientTestingRule to OkHttpClientTestRule 2019-03-07 07:24:05 -05:00
Amir Livneh
aca6785440 Use a TestRule to check for connection leaks 2019-03-06 06:21:15 -05:00
Amir Livneh
851e37f52a Test for connection leaks in more tests
This will help prevent regressions and point to the leaking test, rather than to a later test that happens to checks for leaks. The change is applied to all tests that have an OkHttpClient member variable.
2019-03-02 16:51:18 -05:00
Jesse Wilson
4bea2830d9 Test that duplex works fine with interceptors 2019-02-26 21:48:28 -05:00
Benoit Quenaudon
c49abad3a2 Introduces isDuplex method to RequestBody 2019-02-26 12:05:56 -05:00
Jesse Wilson
0a59e68b16 [maven-release-plugin] prepare for next development iteration 2019-02-05 12:15:46 -05:00
Jesse Wilson
d28d2cec21 [maven-release-plugin] prepare release parent-3.13.1 2019-02-05 12:15:39 -05:00
Jesse Wilson
5ecd590c8c [maven-release-plugin] prepare for next development iteration 2019-02-04 23:32:52 -05:00
Jesse Wilson
d55661544b [maven-release-plugin] prepare release parent-3.13.0 2019-02-04 23:32:45 -05:00
Jesse Wilson
392165d238 Improve testing in MockDuplexResponseBody 2019-02-03 21:56:39 -05:00
Jesse Wilson
8dcfaf02b5 Turn DuplexRequestBody into a marker interface.
And later maybe a simple public method.
2019-01-31 19:42:06 -05:00
Jesse Wilson
778e0334a4 Use lambdas where appropriate 2019-01-11 22:31:36 -05:00
Jesse Wilson
bf8e653c3a Get the latest versions of things.
I used 'mvn versions:use-latest-versions' and also just a bunch of manual
fixing.
2018-12-28 15:53:46 -05:00
Jesse Wilson
c273b3be38 [maven-release-plugin] prepare for next development iteration 2018-11-16 23:44:19 -05:00
Jesse Wilson
7f63a35ab1 [maven-release-plugin] prepare release parent-3.12.0 2018-11-16 23:44:12 -05:00
Jesse Wilson
04a74b2df4 Confirm that call timeouts don't apply to SSE or web sockets. 2018-11-06 21:42:34 +11:00
Jesse Wilson
7ef5f55d38 [maven-release-plugin] prepare for next development iteration 2018-07-12 23:41:09 -04:00
Jesse Wilson
95ae0cf421 [maven-release-plugin] prepare release parent-3.11.0 2018-07-12 23:41:00 -04:00
Yuri Schimke
adb2a82049 Dont System.exit the test runner (#3888)
* Dont System.exit

* Maven aware uncaught exception handling

* cleanup
2018-02-25 22:32:03 -05:00
Jesse Wilson
e86eb0e48b [maven-release-plugin] prepare for next development iteration 2018-02-24 13:33:57 -05:00
Jesse Wilson
c0739a4199 [maven-release-plugin] prepare release parent-3.10.0 2018-02-24 13:33:52 -05:00
Yuri Schimke
14215b8b3f cleanup travis output (#3853) 2018-02-17 09:25:41 -05:00
Yuri Schimke
d27531afa9 Use manifest entry for java 9 module name (#3743)
* Use manifest entry for java 9 module name

* add group

* specific names

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml
2018-02-04 03:02:20 -05:00
Jesse Wilson
2bb2dc4340 [maven-release-plugin] prepare for next development iteration 2017-11-18 14:38:02 -05:00
Jesse Wilson
23b6f7556d [maven-release-plugin] prepare release parent-3.9.1 2017-11-18 14:37:50 -05:00
jwilson
51311219af [maven-release-plugin] prepare for next development iteration 2017-09-04 17:00:21 -04:00
jwilson
51663fd08f [maven-release-plugin] prepare release parent-3.9.0 2017-09-04 17:00:16 -04:00