示例#1
0
        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));
        }
示例#2
0
        /// <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);
        }
示例#3
0
        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);
        }