Commit Graph

6625 Commits

Author SHA1 Message Date
nathanmittler 66ce6677b2 Updating version of gRPC maven build to 0.1.0-SNAPSHOT.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82151533
2015-01-08 14:43:20 -08:00
ejona 4523059762 Upgrade OkHttp for Android SNI / NPN fix
https://github.com/square/okhttp/pull/1137
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82149209
2015-01-08 14:43:20 -08:00
lryan 601b56e61a Update grpc opensource build to depend on okhttp-2.1
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81918687
2015-01-08 14:43:19 -08:00
ejona ce8723bcaf Add Netty as a git submodule.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81831533
2015-01-08 14:43:19 -08:00
ejona 1852e9c3d5 Add gitignore to github repo.
This is based on an external GitHub commit by JakeWharton.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81830485
2015-01-08 14:43:19 -08:00
ejona 42989a83ff Allow killing test server/client
mvn exec:exec doesn't kill the child process when Maven is killed. Now
we just run ourselves, but have Maven do as much heavy lifting as able.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81736090
2015-01-08 14:43:18 -08:00
ejona fc30031fd1 Change default gRPC protocol to v2.
Any place that force-sets the protocol to 2 or assumes the old value
is now removed. Unfortunately, it seems InProcessTransportTest has
some non-obvious dependency on gRPC v1.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81597524
2015-01-08 14:43:18 -08:00
simonma 682f8aa2cb Correct comment
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81595612
2015-01-08 14:43:18 -08:00
nathanmittler 70341df582 Fixing Maven build for gRPC Java.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81456318
2015-01-08 14:43:17 -08:00
lryan 56e307fcb6 Add BSD license header to all source files
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81447025
2015-01-08 14:43:17 -08:00
lryan 7f55e8163a Allow use of a LocalChannel with Netty & HTTP2
Remove old in-process handling
Update tests and benchmarks

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81381986
2015-01-08 14:43:15 -08:00
rocking 9dd0c944c8 Add SslSocketFactory support to OkHttpTransportFactory.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81367843
2015-01-08 14:43:15 -08:00
zhangkun 2b116ef2cd Encode binary headers with Base64 on the wire, and requires all binary headers
have "-bin" suffix in their names.

Split Metadata.Marshaller into BinaryMarshaller and AsciiMarshaller.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81306135
2015-01-08 14:43:15 -08:00
zhangkun 63fc64761a Inspect content type from trailers when there are no headers.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81291102
2015-01-08 14:43:14 -08:00
ejona fb09bba456 Don't leak decompressor in gRPC v2.
We don't use the decompressor at all in gRPC v2, but it may still have
resources that should be close()d.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81271990
2015-01-08 14:43:14 -08:00
simonma 751a4df52a Remove JDK1.7 method InetSocketAddress#getHostString since JDK1.7 is only supported by Android after 4.4 KitKat.
Now we pass the host directly into OkHttpClientTranport for 2 reasons:
1. We don't need to call InetAddress/InetSocketAddress.getHostName(), which will do a reverse DNS lookup, may return a different value other than user specified.
2. In some tests, we want to change the host to match TLS cert, in such case, we can use OkHttpChannelBuilder.overrideHostForAuthority(String host) to override the host, then the transport will get the overridden value.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81169377
2015-01-08 14:43:14 -08:00
zhangkun 8375cd00e8 GRPC Java clients will send the "te: trailers" header, and the server will
check for it, so that we can detect intermediate proxies that do not support
trailers.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81084983
2015-01-08 14:43:13 -08:00
zhangkun 4332c2f56e Change the HTTP code -> GRPC Status mapping to comply with http canonical mapping
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80767939
2015-01-08 14:43:13 -08:00
lryan c5e70c2310 Remove StreamState and use inboundPhase/outboundPhase instead
Remove synchronization on stateLock as we are not required to be thread safe
Add better toString for stream impls
Internal cleanup of various 'status' fields in AbstractClientStream
Remove 'stashTrailers' as we've already extracted status in layer above correctly

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80678356
2015-01-08 14:43:12 -08:00
nathanmittler abdbf4940a Changing TestServiceServer to use ListenableFuture for determining when the server has been successfully started.
Previously, it was creating a client socket to determine when the server
was bound to the port. This causes the Netty server to create and then
quickly fail a client channel which was generating noisy error logs.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80546045
2015-01-08 14:43:12 -08:00
nathanmittler be29ba57cc Upgrading to latest Netty.
Fixes race condition while shutting down.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80484055
2015-01-08 14:43:12 -08:00
ejona f96e7e8c6c Use real TLS security by default.
The client now checks certificates and performs hostname verification.
Tests check certificates, so the server uses a cert that the client
trusts.

Only the client portion of SslContextFactory was previously used.
Applications that want to ignore certificates (i.e., for testing) can
use io.netty.handler.ssl.util.InsecureTrustManagerFactory instead.

The MOE configuration was already failing to work, and so required the
simple mapping for examples in addition to what was needed for the new
certs.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80434148
2015-01-08 14:43:11 -08:00
zhangkun b186b377e8 Remove client-streaming and bi-di streaming methods from blocking client interface.
The current signatures are not more useful than the async counterparts,
we'd rather not have them until more sepcific requirement comes up.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80402647
2015-01-08 14:43:11 -08:00
nathanmittler 0d8477c85c Adding crude outbound flow control to OkHttp transport.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80390743
2015-01-08 14:43:10 -08:00
nathanmittler d7f78773ea Allow stream state HALF_CLOSED_REMOTE in the gRPC Java client.
This is allowed in the gRPC v2 spec since trailers may be sent early to
convery error information.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80387029
2015-01-08 14:43:10 -08:00
zhangkun 054f595eaa Separate the default event loop groups for client and server, to prevent
contention between client and server in the same test process.
Name the threads of default thread pools.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80326782
2015-01-08 14:43:10 -08:00
ejona 28a2abaa15 Enable full-size payloads in integration tests.
Netty's flow control bug is now fixed.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80298613
2015-01-08 14:43:09 -08:00
nathanmittler 63271f4729 Fixing a compatibility issue between the GFE and gRPC java client for the V2 protocol.
The GFE should not be sending DATA frames with endOfStream=true.
However to make things work in the short-term, if we receive one we
still need to process the DATA frame.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80243944
2015-01-08 14:43:09 -08:00
nathanmittler 5d953e840b Updating gRPC code to use the latest Netty with application-level flow control support.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80230204
2015-01-08 14:43:09 -08:00
ejona 01152e093d Fix workaround in place for GFE's lack of trailers.
A recent refactoring moved code so our previous workaround stopped
producing any effect.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79965647
2015-01-08 14:43:08 -08:00
ejona 0f56c47ac8 Handle exceptions thrown by the application
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79895899
2015-01-08 14:43:08 -08:00
lryan 1f2a1869e5 Fix NullPointerException in AbstractServerStream when deframer reports error and fix error message propagation
Improve detail of deframer error reporting to client

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79799152
2015-01-08 14:43:07 -08:00
zhangkun aa0b7cc9af Forbid calling next more than once in interceptors.
Will throw IllegalStateException.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79717262
2015-01-08 14:43:07 -08:00
lryan 4073a8a1a7 Remove redundant field from AbstractClientStream
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79592498
2015-01-08 14:43:07 -08:00
lryan 669724a588 Rationalize the XXXStream classes to reduce code smear and make Netty/OkHTTP behave more consistently.
More cleanups to follow
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79574504
2015-01-08 14:43:06 -08:00
ejona ff669ac9c2 More precise Builder generics
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79430607
2015-01-08 14:43:06 -08:00
ejona ba653d4bd0 Move StubConfigTest to third_party
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79430433
2015-01-08 14:43:05 -08:00
ejona 2a93c47657 Remove GrpcServer to allow more tests to move to third_party.
GrpcServer had the same restriction that GrpcClient did: it had a
single enum of all transports that prevents using it in third_party.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79428440
2015-01-08 14:43:05 -08:00
ejona 1553aabb2f Advertise h2-15 in ALPN negotiation.
We continue to support h2-14 to prevent having a flag-day. Flag-day
is unnecessary since h2-15 is pretty much the same as h2-14.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79369997
2015-01-08 14:43:05 -08:00
zhangkun a71d887661 Make all transport factories package-private in favor of channel builders.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79367593
2015-01-08 14:43:04 -08:00
zhangkun 776ff86687 Eliminate ForwardingChannel and switch all use cases to client interceptors.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79360027
2015-01-08 14:43:04 -08:00
zhangkun 48e734d7e3 Dedicated ClientInterceptor interface and utilities.
This will replace the channel-wrapping technique as the official
solution of intercepting calls on the client side. It is done in the
same manner as ServerInterceptor.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79280263
2015-01-08 14:43:04 -08:00
ejona 9a148a5022 Remove outbound flow control interface.
We know we don't like the API, but don't yet have the new one in place.
Remove the old one now instead of waiting further, because we are
getting more users who are more likely to try to start using the API.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79090165
2015-01-08 14:43:03 -08:00
ejona 3d4ea0d348 Implement standard integration tests (almost).
Our pre-existing tests were slightly different from the integration
tests to be implemented in each language. Change our implementation to
match.

Unfortunately, the standard tests actually trigger Netty flow control
bugs, so we decrease stream sizes to <64K as a workaround.

Because the tests now compare to golden responses, they detected that
the cpp server was sending all a's instead of all 0s. That is now fixed.

We receive errors hitting CPP server for empty_unary and the various
streaming tests, so java_cpp isn't enabled in interop_scenarios.txt.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79086882
2015-01-08 14:43:03 -08:00
ejona e813eaae2f [3/3] Use AbstractTransportTest for test case impls in TestServiceClient.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78862990
2015-01-08 14:43:03 -08:00
ejona 97d3ade2ea [2/3] Use transport builders instead of ClientBootstrap.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78861122
2015-01-08 14:43:03 -08:00
ejona 9a5a8de65d [1/3] Move AbstractTransportTest to third_party.
This required making it no longer depend on GrpcClient. Instead, we now
use the builders that make using GrpcClient almost completely obsolete.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78860648
2015-01-08 14:43:02 -08:00
simonma 8b0b46eff5 Move examples to third_party.
Remove FormattingLogger usage.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78798688
2015-01-08 14:43:02 -08:00
nathanmittler ffc18f6c57 Adding MOE configuration for grpc_java.
The TestService proto is temporarily supplied as a generated jar (until the open source protoc compiler supports grpc).

Copies of messages.proto, empty.proto, and message_set.proto are scrubbed and included in the source under integration-testing.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78711468
2015-01-08 14:43:02 -08:00
zhangkun 7dc48e2787 SharedResourceHolder is a utility that manages expensive resources (thread
pools etc) that are shared among channels and servers as default values when
the application doesn't provide its own.

It uses reference counting to shut down resources with a delay.

Changed the channel and server builders to use it for default values of
executors and event loop groups.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78629204
2015-01-08 14:43:01 -08:00