public async Task SingletonDnsChangeTest() { HostsFile.Set(_hostname, "127.0.0.1"); var client = new SingletonHttpClient(_uri); var timer = Stopwatch.StartNew(); try { await new LoopUntilFailure(client).ExecuteAsync( () => Task.Run(() => HostsFile.Set(_hostname, "128.0.0.1"))); } catch { _logger.WriteLine($"{typeof(IHttpClient).Name} - {timer.ElapsedMilliseconds}"); } }
public async Task SingletonDnsChangeWithConnectionLeaseTimeoutAndDnsRefreshTimeoutTest() { HostsFile.Set(_hostname, "127.0.0.1"); ServicePointManager.DnsRefreshTimeout = 10000; ServicePointManager.FindServicePoint(_uri).ConnectionLeaseTimeout = 10000; var client = new SingletonHttpClient(_uri); var timer = Stopwatch.StartNew(); try { await new LoopUntilFailure(client).ExecuteAsync( () => Task.Run(() => HostsFile.Set(_hostname, "128.0.0.1"))); } catch { _logger.WriteLine($"{typeof(IHttpClient).Name} - {timer.ElapsedMilliseconds}"); } }