public void SetUp()
 {
     _proxy  = new PassThroughProxy(ProxyPort);
     _server = new HttpStubServer(_serverBaseAddress);
     _client = new HttpClient(_handler = new HttpClientHandler
     {
         Proxy = new WebProxy(_proxyBaseAddress, false)
     });
 }
Ejemplo n.º 2
0
        public void SetUp(bool rejectHttpProxy = false)
        {
            Configuration.Settings = new Configuration(
                new Server(ProxyPort, rejectHttpProxy),
                new Authentication(false, null, null),
                new Firewall(false, new Rule[] { }));

            _proxy  = new PassThroughProxy(ProxyPort, Configuration.Settings);
            _server = new HttpStubServer(_serverBaseAddress);
            _client = new HttpClient(_handler = new HttpClientHandler
            {
                Proxy = new WebProxy(_proxyBaseAddress, false)
            });
        }
Ejemplo n.º 3
0
        public async Task TorHttpsProxy_EndToEnd()
        {
            var proxyUsername = "******";
            var proxyPassword = "******";

            using (var proxyPort = ReservedPort.Reserve())
                using (var ptp = new PassThroughProxy(proxyPort.Port, new Configuration(
                                                          new Server(proxyPort.Port, rejectHttpProxy: true),
                                                          new Authentication(true, proxyUsername, proxyPassword),
                                                          new Firewall(false, new Rule[0]))))
                    using (var te = TestEnvironment.Initialize(_output))
                    {
                        // Arrange
                        var settings = te.BuildSettings();
                        settings.TorSettings.HttpsProxyHost     = "localhost";
                        settings.TorSettings.HttpsProxyPort     = proxyPort.Port;
                        settings.TorSettings.HttpsProxyUsername = proxyUsername;
                        settings.TorSettings.HttpsProxyPassword = proxyPassword;
                        settings.ToolRunnerType = ToolRunnerType.Simple;

                        // Act & Assert
                        await ExecuteEndToEndTestAsync(settings);
                    }
        }