2019-04-29 12:11
浏览 536

如何为安全的go grpc服务创建不安全的Java grpc客户端

I am trying to create grpc service client in Java where server is in goLang and deployed with the https . where I am trying to achieve a non-secured connection [I don't want to pass the certificate ]

public class testgrpc {
    ManagedChannel channel ;
    ServiceGrpc.ServiceBlockingStub  blockingStub;
    String host = "remotesecuredhost";
    int port ="XXX";

    public void testgrpc()
    channel = ManagedChannelBuilder.forAddress(host,port).build();

     blockingStub = ServiceGrpc.newBlockingStub(channel);

    response =;



the above code gives following exception

io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
    at io.grpc.stub.ClientCalls.toStatusRuntimeException(
    at io.grpc.stub.ClientCalls.getUnchecked(
    at io.grpc.stub.ClientCalls.blockingUnaryCall(

can someone help with Client code

图片转代码服务由CSDN问答提供 功能建议

我正在尝试用Java创建grpc服务客户端,其中服务器位于goLang中,并使用https进行部署。 我试图建立非安全连接的位置[我不想通过证书] </ p>

 公共类testgrpc {
 ManagedChannel channel; 
 ServiceGrpc.ServiceBlockingStub  BlockingStub; 
字符串host =“ remotesecuredhost”; 
 int port =“ XXX”; 
 public void testgrpc()
 channel = ManagedChannelBuilder.forAddress(host,port).build  (); 
blockingStub = ServiceGrpc.newBlockingStub(channel); 
 response =。build()); 
 <  / code> </ pre> 

上面的代码给出了以下异常</ p>

在io.grpc  .stub.ClientCalls.toStatusRuntimeException(
在io.grpc.stub.ClientCalls.blockingUnaryCall(  )
 </ code> </ pre> 

有人可以帮助客户代码</ p> </ div>

3条回答 默认 最新

相关推荐 更多相似问题