Commit Graph

423 Commits

Author SHA1 Message Date
Sergii Tkachenko 641c54eb3d okhttp: exclude Internal* from javadoc 2020-10-21 16:11:57 -04:00
Eric Anderson e595779047 okhttp: Add ChannelCredentials 2020-10-07 13:58:37 -05:00
Eric Anderson c8a94d1059 api: Add ChannelCredentials 2020-10-07 13:58:37 -05:00
Eric Anderson 4c1bab9ed5 Prepare for JUnit 4.13
It deprecates ExpectedException and Assert.assertThat(T, org.hamcrest.Matcher).
Without Java 8 we don't want to migrate away from ExpectedException at
this time. We tend to prefer Truth over Hamcrest, so I swapped the one
instance of Assert.assertThat() to use Truth. With this change we get a
warning-less build with JUnit 4.13. We don't yet upgrade because we
still need to support JUnit 4.12 for some use-cases, but will be able to
upgrade to 4.13 soon when they upgrade.
2020-09-28 17:07:50 -05:00
Sergii Tkachenko cccd940e43
okhttp: cleanup channel in channel builder tests 2020-09-16 11:38:55 -04:00
Sergii Tkachenko af6fbf6b74 okhttp: make OkHttpChannelBuilder final 2020-09-11 19:54:31 -04:00
Sergii Tkachenko d5dcfa737a
all: remove deprecated internal OverrideAuthorityChecker 2020-09-11 19:14:25 -04:00
Sergii Tkachenko e610637440
okhttp: Keep ChannelBuilder.checkAuthority() for backward compatibility 2020-09-08 14:33:53 -04:00
Sergii Tkachenko 88634ee0d5 okhttp: allow disable check authority via internal channel builder 2020-09-03 18:02:32 -04:00
Sergii Tkachenko 3493347581 okhttp, testing: remove server builder accessor hacks 2020-09-03 16:26:04 -04:00
Sergii Tkachenko b03f148ed9 core, netty: server builders extend a public API class 2020-09-03 16:26:04 -04:00
Sergii Tkachenko c29ad76dae Explain test value for flow control window 2020-09-02 14:51:39 -04:00
Sergii Tkachenko 5d1304c33c okhttp: OkHttpChannelBuilder extends a public API class 2020-09-02 13:28:52 -04:00
Eric Anderson e92b2275f9 Update to Error Prone 2.4
Most of the changes should be semi-clear why they were made. However, BadImport
may not be as obvious: https://errorprone.info/bugpattern/BadImport . That
impacted classes named Type, Entry, and Factory. Also
PublicContructorForAbstractClass:
https://errorprone.info/bugpattern/PublicConstructorForAbstractClass

The JdkObsolete issue is already resolved but is not yet in a release.
2020-08-06 10:56:16 -05:00
Eric Anderson 80d62bfce2 Upgrade to Mockito 3.3.3
verifyZeroInteractions has the same behavior as verifyNoMoreInteractions. It
was deprecated in Mockito 3.0.1 and replaced with verifyNoInteractions, which
does not change behavior depending on previous verify() calls. All instances
were replaced with verifyNoInteractions, except those in
ApplicationThreadDeframerTest which were replaced with verifyNoMoreInteractions
since there is a verify() call in `@Before`.
2020-08-06 10:49:23 -05:00
Jihun Cho c6bd97245c
core: disable MigratingThreadDeframer (#7177) 2020-07-01 15:39:13 -07:00
Jihun Cho b6a63e75e2
okhttp: not using MigratingThreadDeframer (#7167)
* okhttp: not using MigratingThreadDeframer

* fix comments/todo
2020-06-29 16:39:43 -07:00
Eric Anderson 295d927d8b core: Add migrating deframer
This provides a substantial ~3x performance increase to Netty async
streaming with small messages. It also increases OkHttp performance for
the same benchmark 40% and decreases unary latency by 3µs for Netty and
10µs for OkHttp.

We avoid calling listener after closure because the Executor used for
RPC callbacks may no longer be available. This issue was already
present in the ApplicationThreadDeframer, but full-stream compression is
not really deployed so was unnoticed.

DirectExecutor saw a 5-6µs latency increase via MigratingDeframer.
DirectExecutor usages should see no benefit from MigratingDeframer, so
disable it in that case.
2020-06-18 15:48:29 -05:00
ZHANG Dapeng 0044f8ce56
all: migrate gradle build to java-library plugin
- Use gradle configuration `api` for dependencies that are part of grpc public api signatures.
- Replace deprecated gradle configurations `compile`, `testCompile`, `runtime` and `testRuntime`.
- With minimal change in dependencies: If we need dep X and Y to compile our code, and if X transitively depends on Y, then our build would still pass even if we only include X as `compile`/`implementation` dependency for our project. Ideally we should include both X and Y explicitly as `implementation` dependency for our project, but in this PR we don't add the missing Y if it is previously missing.
2020-05-04 16:44:30 -07:00
Chengyuan Zhang b8bcf98f33
okhttp: use new APIs to configure TLS in Android (roll forward #6959) (#6960)
* Revert "okhttp: revert changes for using new APIs to configure TLS in Android (#6959)"

This reverts commit ee8b395f79.

Roll forward with adding manual check if hostname contains underscore, as Android's URI implementation allows underscore in hostsname.
2020-04-22 10:28:56 -07:00
Chengyuan Zhang ee8b395f79
okhttp: revert changes for using new APIs to configure TLS in Android (#6959)
* Revert "okhttp: Skip enabling SNI and session ticket for fake/test host names (#6949)"

This reverts commit eb8e31409e.

* Revert "okhttp: use new APIs for configuring TLS whenever possible (Android Q+) (#6912)"

This reverts commit 5803dfd9dc.
2020-04-21 15:05:53 -07:00
Chengyuan Zhang eb8e31409e
okhttp: Skip enabling SNI and session ticket for fake/test host names (#6949)
Work around for cases (usually for tests) where hostname is overridden for test certs and it is in invalid syntax.
2020-04-20 17:30:01 -07:00
Chengyuan Zhang 5803dfd9dc
okhttp: use new APIs for configuring TLS whenever possible (Android Q+) (#6912)
Use new APIs for configuring TLS in Android environment. Starting from Android 29, there is a new set of public APIs for configuring ALPN (and starting from Android 24, there is API for enabling SNI). This change migrates to use these new APIs whenever possible. Only fallback to call the old hidden APIs if new ones do not exist (or do not work).
2020-04-17 11:44:08 -07:00
Eric Anderson 186cfebcba all: Move jacocoTestReport exclusions to individual projects
The sourceSets.main.output.collect should probably be improved at some point to
improve loading performance, but this is technically better than what we had
before so let's call it a win and move on.
2020-04-01 10:33:32 -07:00
chrisschek bf2a66c8a2
okhttp: fix incorrect connection-level flow control handling at beginning of connection
Specifically, this addresses bugs that occur when the `OkHttpChannelBuilder.flowControlWindow(int)` setting is increased from its default value.

Two changes:
1. On starting a connection, ensure the value of `OkHttpChannelBuilder.flowControlWindow(int)` is sent via Settings.INITIAL_WINDOW_SIZE. Also send a WINDOW_UPDATE after Settings to update the connection-level window.
2. Always initialize the `OutboundFlowController` with an initialWindowSize of 65335 bytes per the [http2 spec](https://http2.github.io/http2-spec/#InitialWindowSize) instead of using the inbound window size.

Fixes #6685
2020-02-27 12:34:23 -08:00
sanjaypujare dba09163de
netty: remove 'grpc-exp' from the list of next-protocol-versions in ALPN (#6592) 2020-01-09 16:41:20 -08:00
Tomo Suzuki 75f6fd8f10 Upgrade error_prone_annotations to 2.3.4 2020-01-03 14:50:34 -08:00
Graeme Morgan d3c77f2d87 all: Add suppressions for GuardedBy violations
This supports releasing a new version of GuardedBy which finds more mistakes than it used to.

Filed #6578 to try to clean up the suppressions.
2019-12-30 10:17:05 -08:00
Tomo Suzuki 29638780ae build: Replaced outdated comments (#6492) 2019-12-05 13:53:51 -08:00
ZHANG Dapeng 2d454d478c
Revert "Revert "all: remove deprecated usePlaintext(boolean)""
This reverts commit 316a739e67.
2019-11-18 16:53:52 -08:00
Jihun Cho 30f8f26f7a okhttp: use FINE log for pure IOExceptions 2019-10-24 15:17:16 -07:00
Carl Mastrangelo f2d0f87d2e compiler: set safe and idempotent bits on method descriptors 2019-10-22 10:59:11 -07:00
ZHANG Dapeng 316a739e67
Revert "all: remove deprecated usePlaintext(boolean)"
This reverts commit 296857b4e7.
2019-10-10 15:56:47 -07:00
Ran ba17682eb2
okhttp: fix header scheme does not match transport type. (#6260)
okhttp: fix header scheme does not match transport type.
2019-10-09 18:00:45 -07:00
Chengyuan Zhang b69f19d589
okhttp: add full implementation of HPACK header compression (#6026)
This change added the missing implementation of HTTP/2 HPACK for writer. The implementation is copied (and modified) from upstream OkHttp (OkHttp3). 

- Huffman encoding of writer is disabled by default.
2019-10-08 10:06:26 -07:00
ZHANG Dapeng 296857b4e7
all: remove deprecated usePlaintext(boolean) 2019-10-08 09:27:39 -07:00
Jihun Cho e9ac1b4a76
all: update modules to wait until other module's sourceSet is available (#6232) 2019-10-02 15:05:44 -07:00
Carl Mastrangelo ab2aff48dc netty,okhttp,cronet: add option to use get/put when methods are safe/idempotent
This change adds two booleans to the ChannelBuilders to
allow transports to use get and put.   These are currently defaulted to
on, but unset on the method descriptors.   This change is 1/2 that will
allow the safe / idempotent bits to be set on generated proto code.
Part 2/2 will actually enable it.

The use case for this is for interceptors that implement caching logic.
They need to be able to access the safe/idempotent bits on the MD in
order to decide to how to handle the request, even if gRPC doesn't use
GET / PUT HTTP methods.
2019-09-25 14:57:17 -07:00
Eric Anderson 2b945774b6 Apply animalsniffer plugin explicitly when needed 2019-09-13 09:42:17 -07:00
Eric Anderson 4215b80b81 Apply java plugin explicitly when needed 2019-09-13 09:42:17 -07:00
Eric Anderson e13221b503 Apply japicmp plugin explicitly when needed 2019-09-13 09:42:17 -07:00
Eric Anderson 5b838e5284 Apply maven-publish plugin explicitly when needed 2019-09-13 09:42:17 -07:00
康智冬 415212fc49 alts: fix typo (#6113) 2019-09-10 14:13:35 -07:00
Carl Mastrangelo 4c1e197fcd
okhttp: remove unused import 2019-08-15 16:00:02 -07:00
Chengyuan Zhang ad47eee4d3
okhttp: add PerfMark tracing for okhttp transport (#6038)
* okhttp: add PerfMark tracing for okhttp transport

* change task for AsyncSink to give more accurate task description

* add final to field tag

* add PerfMark dependency in okhttp package bazel
2019-08-14 17:20:29 -07:00
Dharmesh Jogadia 5790503d79 core,okhttp: removed GrpcUtil.IS_RESTRICTED_APPENGINE and dependent code (#6051) 2019-08-13 10:11:56 -07:00
Eric Anderson 26bd76fa76
Upgrade to Gradle 5 2019-06-07 08:40:53 -07:00
Carl Mastrangelo 7657523b28
all: update to error prone 2.3.3 2019-06-05 15:28:43 -07:00
Tim van der Lippe ad0893737e Migrate org.mockito.Matchers#any* to org.mockito.ArgumentMatchers
The former is deprecated and replaced by the latter in Mockito 2.
However, there is a functional difference: ArgumentMatchers will reject
`null` and check the type if the matcher specified a type (e.g.
`any(Class)` or `anyInt()`). `any()` will remain to accept anything.
2019-05-29 16:53:01 -07:00
Eric Anderson 2cbc540cb3 Remove deprecated enableKeepAlive API from transports
As mentioned in 5188[1], the default used with the enableKeepAlive API
conflicted with the default server enforcement. Instead of fixing it,
remove it. These APIs were deprecated in v1.3.0 in April 2017.

1. https://github.com/grpc/grpc-java/issues/5188#issuecomment-482269303
2019-05-28 16:37:02 -07:00