|
|
@ -76,8 +76,7 @@ public class EdgeGrpcClient implements EdgeRpcClient { |
|
|
Consumer<DownlinkMsg> onDownlink, |
|
|
Consumer<DownlinkMsg> onDownlink, |
|
|
Consumer<Exception> onError) { |
|
|
Consumer<Exception> onError) { |
|
|
NettyChannelBuilder builder = NettyChannelBuilder.forAddress(rpcHost, rpcPort) |
|
|
NettyChannelBuilder builder = NettyChannelBuilder.forAddress(rpcHost, rpcPort) |
|
|
.keepAliveTime(keepAliveTimeSec, TimeUnit.SECONDS) |
|
|
.keepAliveTime(keepAliveTimeSec, TimeUnit.SECONDS); |
|
|
.usePlaintext(); |
|
|
|
|
|
if (sslEnabled) { |
|
|
if (sslEnabled) { |
|
|
try { |
|
|
try { |
|
|
builder.sslContext(GrpcSslContexts.forClient().trustManager(new File(Resources.getResource(certResource).toURI())).build()); |
|
|
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); |
|
|
log.error("Failed to initialize channel!", e); |
|
|
throw new RuntimeException(e); |
|
|
throw new RuntimeException(e); |
|
|
} |
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
builder.usePlaintext(); |
|
|
} |
|
|
} |
|
|
channel = builder.build(); |
|
|
channel = builder.build(); |
|
|
EdgeRpcServiceGrpc.EdgeRpcServiceStub stub = EdgeRpcServiceGrpc.newStub(channel); |
|
|
EdgeRpcServiceGrpc.EdgeRpcServiceStub stub = EdgeRpcServiceGrpc.newStub(channel); |
|
|
|