diff --git a/Sources/ZcashLightClientKit/Service/LightWalletGRPCService.swift b/Sources/ZcashLightClientKit/Service/LightWalletGRPCService.swift index dacd8e71..7b8e72f4 100644 --- a/Sources/ZcashLightClientKit/Service/LightWalletGRPCService.swift +++ b/Sources/ZcashLightClientKit/Service/LightWalletGRPCService.swift @@ -112,14 +112,19 @@ public class LightWalletGRPCService { self.streamingCallTimeout = TimeLimit.timeout(.milliseconds(streamingCallTimeout)) self.singleCallTimeout = TimeLimit.timeout(.milliseconds(singleCallTimeout)) - let configuration = ClientConnection.Configuration( - target: .hostAndPort(host, port), - eventLoopGroup: MultiThreadedEventLoopGroup(numberOfThreads: 1), - connectivityStateDelegate: connectionManager, - connectivityStateDelegateQueue: queue, - tls: secure ? .init() : nil - ) - let channel = ClientConnection(configuration: configuration) + let connectionBuilder = secure ? + ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads: 1)) : + ClientConnection.insecure(group: MultiThreadedEventLoopGroup(numberOfThreads: 1)) + + let channel = connectionBuilder + .withConnectivityStateDelegate(connectionManager, executingOn: queue) + .withKeepalive( + ClientConnectionKeepalive( + interval: .seconds(15), + timeout: .seconds(10) + ) + ) + .connect(host: host, port: port) self.channel = channel diff --git a/Tests/TestUtils/Tests+Utils.swift b/Tests/TestUtils/Tests+Utils.swift index e42d9ba6..4d110bc1 100644 --- a/Tests/TestUtils/Tests+Utils.swift +++ b/Tests/TestUtils/Tests+Utils.swift @@ -38,14 +38,21 @@ enum LightWalletEndpointBuilder { class ChannelProvider { func channel(secure: Bool = false) -> GRPCChannel { let endpoint = LightWalletEndpointBuilder.default - - let configuration = ClientConnection.Configuration( - target: .hostAndPort(endpoint.host, endpoint.port), - eventLoopGroup: MultiThreadedEventLoopGroup(numberOfThreads: 1), - tls: secure ? .init() : nil - ) - return ClientConnection(configuration: configuration) + let connectionBuilder = secure ? + ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads: 1)) : + ClientConnection.insecure(group: MultiThreadedEventLoopGroup(numberOfThreads: 1)) + + let channel = connectionBuilder + .withKeepalive( + ClientConnectionKeepalive( + interval: .seconds(15), + timeout: .seconds(10) + ) + ) + .connect(host: endpoint.host, port: endpoint.port) + + return channel } }