private Response Send(TimeSpan timeout, TimeSpan sendLatency) { return(provider.SendWithTimeoutAsync((_, token) => Task.Run( async() => { calledSender = true; senderToken = token; await Task.Delay(sendLatency, token); return senderResponse; }), request, timeout, cancellation.Token) .GetAwaiter() .GetResult()); }
/// <inheritdoc /> public Task <Response> SendAsync(Request request, TimeSpan?connectionTimeout, TimeSpan timeout, CancellationToken token) => timeoutProvider.SendWithTimeoutAsync((r, t) => SendAsync(r, connectionTimeout, t), request, timeout, token);