Commit Graph

202 Commits

Author SHA1 Message Date
Eric Anderson ada32b0cb1 Optimize number of DATA frames for unary requests
Resolves #10
2015-01-22 16:45:20 -08:00
zhangkun83 5e6078594b Add test target for codegen.
Make all test messages empty since we are not testing protobuf
generator.
2015-01-22 16:04:02 -08:00
nmittler 02cc5217a2 Fixing @GuardedBy annotation to use the correct lock name. 2015-01-22 12:33:24 -08:00
nmittler de3a13164f Changing gRPC Java inbound flow control model
The goal is to mirror the token-based approach used by the Reactive
Streams API.
2015-01-22 11:46:16 -08:00
nmittler 52f4220395 Adding .gitignore for eclipse files. 2015-01-21 16:14:48 -08:00
Louis Ryan 11026b69cc Fix IntelliJ dependency on generated protobufs 2015-01-20 16:24:52 -08:00
ejona 4de2026492 Fix TODO attribution
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84172357
2015-01-16 16:23:05 -08:00
Eric Anderson 080e33effd Align server flags with other languages
There are also no longer any required arguments. The argument processing
flow was changed to match that of the client.
2015-01-16 13:13:57 -08:00
Eric Anderson 6239965030 Improve test client for real cert
The test client can now be used against a server that has properly
configured certificates, instead of just the test server. To reach the
test server, the client needs these arguments:
--use_test_ca=true --server_host_override=foo.test.google.fr

Client no longer has any required arguments, although for any given
setup needing to specify at least one argument is highly likely.

The arguments have been improved in general to hopefully be more
orthogonal and match those of other language's test clients.
2015-01-16 13:07:29 -08:00
Eric Anderson f681effce9 Update .gitignore for Gradle 2015-01-16 13:05:01 -08:00
simonma f589a4acbb Remove traces of gRPC v1 protocol vs gRPC v2 protocol.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84087425
2015-01-16 11:03:38 -08:00
simonma 3df1c33403 Reimplement test "readStatus" since v2 is here.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84082247
2015-01-16 11:03:36 -08:00
zhangkun 9de8e4b569 Make Java codegen ready for open-source. It can be built with the Github HEAD
of opensource protobuf.

- Moved to third_party under GRPC Java directory
- Using Gradle to build
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84053803
2015-01-15 13:42:49 -08:00
ejona 7235a396b8 Remove Service API from ChannelImpl
This change loses asynchronous notification of channel state-change and
a way to wait until the channel is actually connected. Both of these are
expected to be added back as part of a health API. The important
distinction from Service is that ChannelImpl never permanently fails and
can revert from being started to connecting again.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83875407
2015-01-15 13:42:49 -08:00
ejona 198a756b83 Add toString to Headers and Trailers
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83856622
2015-01-15 13:42:46 -08:00
simonma 828f941e99 Remove dependency on guava Lists for initializing list.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83808289
2015-01-15 13:42:43 -08:00
ejona 3a29c98d40 Don't overwrite transportError in DATA processing
There may already be a transportError, in which case we want to augment
it and not overwrite it.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83807747
2015-01-15 13:37:38 -08:00
nathanmittler 11c363a7ae Disallowing message delivery after status has been delivered to the listener.
Summary of changes:

1) Merged the interfaces MessageDeframer2.Sink and DeframerListener into
MessageDeframer2.Listener. This simplifies the interface of
MessageDeframer2 quite a bit.

2) Added a deliveryPaused() handler to MessageDeframer2.Listener, which
is called by the deframer when there is not enough data to read/deliver
the next message.

3) Modified AbstractStream and AbstractClientStream to manage the timing
of when the closed() event is delivered to the listener. The
transportReportStatus ultimately controls this by creating a task to
close the listener. It either runs this task immediately or when the
next deliveryPaused() event occurs.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83620903
2015-01-09 17:00:25 -08:00
yangg f8524a17b8 Add package name to the method string.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83353207
2015-01-08 14:43:24 -08:00
rocking ee86ee41a0 Nano proto and Proto3 do no include fields that have their default values in the wire format.
Avoid using hasxxxx

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82743695
2015-01-08 14:43:23 -08:00
ejona c0f41920bd Remove gRPC v1 support.
No major refactorings/simplifications were done. Only gRPC v1 support
infrastructure was removed.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82737436
2015-01-08 14:43:23 -08:00
ejona 1c20eb6cef Implement cancel_after_* integration tests
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82734780
2015-01-08 14:43:22 -08:00
ejona 42fcc501b9 Implement empty_stream integration test
The test was going to use a queue like ping_pong, but using a mock
proved much simpler. Thus, I also updated ping_pong to use the simpler
model, because it is useful for the two tests to be similar.

InProcessTransportTest failed for empty_stream due to gRPC v2 issues,
and so instead of ignoring emptyStream() I found the broken tests that
were preventing swapping to gRPC v2 and ignored them instead.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82733943
2015-01-08 14:43:22 -08:00
lryan b09c26b4dd Correctly handle disconnect notifications from Netty.
Previously the code close the HTTP2 streams prior to notifying the
application layer. This was the wrong order as the code depended on
enumerating the open streams to notify the application layer.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82733459
2015-01-08 14:43:22 -08:00
ejona ca749c369f Export test_service codegen source instead of binary lib
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82164712
2015-01-08 14:43:21 -08:00
ejona d4531dae1c Add README
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82154383
2015-01-08 14:43:21 -08:00
nathanmittler 164b734aa9 Adding gradle build for Java grpc
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82152044
2015-01-08 14:43:21 -08:00
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