Fixed grpc over ssl
This commit is contained in:
parent
1d18f9a766
commit
c71ba1f245
@ -76,8 +76,7 @@ public class EdgeGrpcClient implements EdgeRpcClient {
|
||||
Consumer<DownlinkMsg> onDownlink,
|
||||
Consumer<Exception> onError) {
|
||||
NettyChannelBuilder builder = NettyChannelBuilder.forAddress(rpcHost, rpcPort)
|
||||
.keepAliveTime(keepAliveTimeSec, TimeUnit.SECONDS)
|
||||
.usePlaintext();
|
||||
.keepAliveTime(keepAliveTimeSec, TimeUnit.SECONDS);
|
||||
if (sslEnabled) {
|
||||
try {
|
||||
builder.sslContext(GrpcSslContexts.forClient().trustManager(new File(Resources.getResource(certResource).toURI())).build());
|
||||
@ -85,6 +84,8 @@ public class EdgeGrpcClient implements EdgeRpcClient {
|
||||
log.error("Failed to initialize channel!", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
builder.usePlaintext();
|
||||
}
|
||||
channel = builder.build();
|
||||
EdgeRpcServiceGrpc.EdgeRpcServiceStub stub = EdgeRpcServiceGrpc.newStub(channel);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user