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