public override void Dispose() { if (TheTransport != null) { TheTransport.Dispose(); } }
public override IInvoker Refer() { var task = TheTransport.SendAsync(new HttpRequestMessage { Method = new HttpMethod("GET"), RequestUri = new Uri($"{this.Url.Protocol}://{this.Url.Host}:{this.Url.Port}/{this.Url.Path}/head") }); if (task.Wait(this.ClientTimeout / 2)) { task.Result.EnsureSuccessStatusCode(); isOpen[0] = true; } else { isOpen[0] = false; throw new TimeoutException("连接时间超过" + this.ClientTimeout + "毫秒"); } //grpc client service return(new HttpInvoker(TheTransport, Url, isOpen)); }