Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
android/helloworld/ | 23-Nov-2023 | - | 614 | 482 | ||
gradle/wrapper/ | 23-Nov-2023 | - | 6 | 5 | ||
src/ | 23-Nov-2023 | - | 378 | 196 | ||
README.md | D | 23-Nov-2023 | 2 KiB | 60 | 42 | |
build.gradle | D | 23-Nov-2023 | 2.6 KiB | 83 | 67 | |
gradlew | D | 23-Nov-2023 | 5.2 KiB | 173 | 128 | |
gradlew.bat | D | 23-Nov-2023 | 2.2 KiB | 85 | 61 | |
settings.gradle | D | 23-Nov-2023 | 30 | 2 | 1 |
README.md
1grpc Kotlin example 2============================================== 3 4The examples require grpc-java to already be built. You are strongly encouraged 5to check out a git release tag, since there will already be a build of grpc 6available. Otherwise you must follow COMPILING.md. 7 8You may want to read through the 9[Quick Start Guide](https://grpc.io/docs/quickstart/java.html) 10before trying out the examples. 11 12To build the examples, run in this directory: 13 14``` 15$ ./gradlew installDist 16``` 17 18This creates the scripts `hello-world-server`, `hello-world-client`, 19`route-guide-server`, and `route-guide-client` in the 20`build/install/examples/bin/` directory that run the examples. Each 21example requires the server to be running before starting the client. 22 23For example, to try the hello world example first run: 24 25``` 26$ ./build/install/examples/bin/hello-world-server 27``` 28 29And in a different terminal window run: 30 31``` 32$ ./build/install/examples/bin/hello-world-client 33``` 34 35That's it! 36 37Please refer to gRPC Java's [README](../README.md) and 38[tutorial](https://grpc.io/docs/tutorials/basic/java.html) for more 39information. 40 41Unit test examples 42============================================== 43 44Examples for unit testing gRPC clients and servers are located in [./src/test](./src/test). 45 46In general, we DO NOT allow overriding the client stub. 47We encourage users to leverage `InProcessTransport` as demonstrated in the examples to 48write unit tests. `InProcessTransport` is light-weight and runs the server 49and client in the same process without any socket/TCP connection. 50 51For testing a gRPC client, create the client with a real stub 52using an InProcessChannelBuilder.java and test it against an InProcessServer.java 53with a mock/fake service implementation. 54 55For testing a gRPC server, create the server as an InProcessServer, 56and test it against a real client stub with an InProcessChannel. 57 58The gRPC-java library also provides a JUnit rule, GrpcCleanupRule.java, to do the graceful shutdown 59boilerplate for you. 60