Skip to content

Instantly share code, notes, and snippets.

@gistlyn
Last active December 30, 2019 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gistlyn/879d4ea24d4000b8b00864aaa8c1403a to your computer and use it in GitHub Desktop.
Save gistlyn/879d4ea24d4000b8b00864aaa8c1403a to your computer and use it in GitHub Desktop.
Java Google protoc insecure gRPC Service Client TodoWorld Example
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
public class Program {
public static void main(String[] args) {
ManagedChannel channel = ManagedChannelBuilder.forAddress(
"todoworld.servicestack.net", 5054).usePlaintext().build();
GrpcServicesGrpc.GrpcServicesBlockingStub client = GrpcServicesGrpc.newBlockingStub(channel);
Services.Hello request = Services.Hello.newBuilder().setName("gRPC Java").build();
String result = client.getHello(request).getResult();
System.out.println(result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment