示例#1
0
 public void TestCheckGrpcUrlInvalid()
 {
     // Test a number of invalid variations
     Assert.IsNotNull(Utils.CheckGrpcUrl("http://hyperledger.org:1234"));
     Assert.IsNotNull(Utils.CheckGrpcUrl("grpc://hyperledger.org"));
     Assert.IsNotNull("grpc://hyperledger.org:1234/index.html");
 }
示例#2
0
        private string GrpcTLSify(string location)
        {
            location = location.Trim();
            System.Exception e = Utils.CheckGrpcUrl(location);
            if (e != null)
            {
                throw new System.Exception($"Bad TEST parameters for grpc url {location}");
            }

            return(runningFabricTLS ? Regex.Replace(location, "^grpc://", "grpcs://") : location);
        }
示例#3
0
        public BaseClient(string name, string url, Properties properties)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Invalid name");
            }
            Exception e = Utils.CheckGrpcUrl(url);

            if (e != null)
            {
                throw new ArgumentException("Bad url.", e);
            }
            Url        = url;
            Name       = name;
            Properties = properties?.Clone();
        }
示例#4
0
 public void TestCheckGrpcUrlValid()
 {
     // Test a number of valid variations
     Assert.IsNull(Utils.CheckGrpcUrl("grpc://hyperledger.org:1234"));
     Assert.IsNull(Utils.CheckGrpcUrl("grpcs://127.0.0.1:1234"));
 }