1gRPC Hostname Example 2===================== 3 4The hostname example is a Hello World server whose response includes its 5hostname. It also supports health and reflection services. This makes it a good 6server to test infrastructure, like load balancing. 7 8The example requires grpc-java to already be built. You are strongly encouraged 9to check out a git release tag, since there will already be a build of grpc 10available. Otherwise you must follow [COMPILING](../../COMPILING.md). 11 12### Build the example 13 141. Build the hello-world example client. See [the examples README](../README.md) 15 162. Build this server. From the `grpc-java/examples/examples-hostname` directory: 17``` 18$ ../gradlew installDist 19``` 20 21This creates the script `build/install/hostname-server/bin/hostname-server` that 22runs the example. 23 24To run the hostname example, run: 25 26``` 27$ ./build/install/hostname-server/bin/hostname-server 28``` 29 30And in a different terminal window run the hello-world client: 31 32``` 33$ ../build/install/examples/bin/hello-world-client 34``` 35 36### Maven 37 38If you prefer to use Maven: 391. Build the hello-world example client. See [the examples README](../README.md) 40 412. Run in this directory: 42``` 43$ mvn verify 44$ # Run the server (from the examples-hostname directory) 45$ mvn exec:java -Dexec.mainClass=io.grpc.examples.hostname.HostnameServer 46$ # In another terminal run the client (from the examples directory) 47$ cd .. 48$ mvn exec:java -Dexec.mainClass=io.grpc.examples.helloworld.HelloWorldClient 49``` 50 51### Bazel 52 53If you prefer to use Bazel, run from the `grpc-java/examples` directory: 54``` 55$ bazel build :hello-world-client example-hostname:hostname-server 56$ # Run the server 57$ ./bazel-bin/example-hostname/hostname-server 58$ # In another terminal run the client 59$ ./bazel-bin/hello-world-client 60``` 61