Beispiel #1
0
 private ClientOneSideSignedTransport(
     ServerOneSideSignedFuncsForClient transport,
     LightCertificate clientCert,
     AesProtectedByteArray clientCertPass
     )
 {
     _transport      = transport;
     _clientCert     = clientCert;
     _clientCertPass = clientCertPass;
 }
Beispiel #2
0
        public static async Task <ClientOneSideSignedTransport <T1> > CreateInstance(
            ServerOneSideSignedFuncsForClient transport,
            LightCertificate clientCert,
            AesProtectedByteArray clientCertPass,
            CancellationToken cancellationToken,
            List <JsonRpcServerMethodInfo> methodInfos = null
            )
        {
            var result = new ClientOneSideSignedTransport <T1>(
                transport,
                clientCert,
                clientCertPass
                );

            if (methodInfos == null)
            {
                while (true)
                {
                    try
                    {
                        methodInfos = await transport.GetMethodInfos()
                                      .ThrowIfCancelled(cancellationToken).ConfigureAwait(false);

                        break;
                    }
                    catch (TimeoutException)
                    {
                    }
                }
            }
            if (
                !JsonRpcClientProcessor.CheckRpcServerMethodInfos(
                    typeof(T1),
                    methodInfos
                    )
                )
            {
                throw new Exception(
                          "Rpc server method infos not matches with T1"
                          );
            }
            result._stateHelper.SetInitializedState();
            return(await Task.FromResult(result).ConfigureAwait(false));
        }