标准的grpc client调用代码,最简单的方式,就三行代码:
ManagedChannelImpl channel = NettyChannelBuilder.forAddress("127.0.0.1", 6556).build();
DemoServiceGrpc.DemoServiceBlockingStub stub = DemoServiceGrpc.newBlockingStub(channel);
stub.login(LoginRequest.getDefaultInstance());
这三行代码,完成了grpc客户端调用服务器端最重要的三个步骤: