public static bool TryParse(string fullAddress, out HostEndpointAddress address) { address = null; var match = AddressPattern.Match(fullAddress); if (!match.Success) { return(false); } address = new HostEndpointAddress(match.Groups["address"].Value, int.Parse(match.Groups["port"].Value)); return(true); }
public static GrpcChannel Create(HostEndpointAddress address) { var baseAddress = new Uri(address.FullAddress); Log.Trace("Creating channel with connection {Address}", address.FullAddress); var channelOptions = new GrpcChannelOptions() { DisposeHttpClient = true, HttpClient = GrpcWebHttpClientFactory.Create(baseAddress, new AuthenticationSurface(address, new AuthenticationStorage(address))) }; var channel = GrpcChannel.ForAddress(new Uri(address.FullAddress), channelOptions); return(channel); }
public static GrpcChannel GetChannelFor(HostEndpointAddress address) { return(Channels.GetOrAdd(address.FullAddress.ToUpper(), s => GrpcChannelFactory.Create(address))); }