Example #1
0
        public void TestMethod1()
        {
            var port  = 9988;
            var proxy = new HttpProxy(port);

            proxy.OnRequestHeaders += (s, e) =>
            {
                Assert.AreEqual("www.google.com", e.Session.Request.Headers.Host);
            };
            proxy.Start();

            var httpClientHandler = new HttpClientHandler()
            {
                Proxy = new WebProxy(new Uri($"http://127.0.0.1:{port}")),
            };
            var c   = new HttpClient(httpClientHandler);
            var res = c.GetAsync("http://www.google.com").Result;

            proxy.Stop();
        }
 public void Dispose()
 {
     HttpProxy.Stop();
     SslProxy.Stop();
 }