public async Task SideChainClient_TryHandShakeAsync() { var result = await sideClient.TryHandShakeAsync(0, ListenPort); result.Result.ShouldBeTrue(); sideClient = new GrpcClientForSideChain("localhost:3000", 1); await Assert.ThrowsAsync <RpcException>(() => sideClient.TryHandShakeAsync(0, 3000)); }
/// <summary> /// Create a new client to parent chain /// </summary> /// <returns> /// </returns> private IGrpcCrossChainClient CreateGrpcClient(GrpcCrossChainCommunicationContext grpcClientBase) { string uri = grpcClientBase.ToUriStr(); if (!grpcClientBase.RemoteIsSideChain) { return(new GrpcClientForParentChain(uri, grpcClientBase.LocalChainId, grpcClientBase.ConnectionTimeout)); } var clientToSideChain = new GrpcClientForSideChain(uri, grpcClientBase.ConnectionTimeout); return(clientToSideChain); }
private void InitServerAndClient() { var keyStore = _certificateStore.LoadKeyStore("test"); var cert = _certificateStore.LoadCertificate("test"); var keyCert = new KeyCertificatePair(cert, keyStore); _server.StartAsync(Host, ListenPort).Wait(); string uri = $"{Host}:{ListenPort}"; parentClient = new GrpcClientForParentChain(uri, 0, 1); sideClient = new GrpcClientForSideChain(uri, 1); }