Search code examples
c#proxynunittitanium-web-proxy

Requesting a certificate every time after the starts unit tests with titanium-web-proxy


each time when I run unit tests by NUnit(2.6.4) that use titanium-web-proxy(3.0.398-beta) appears security warning about installing the certificate, but if I start titanium-web-proxy like the standalone app it asks only at first time and then starts without the security warning. The code of launching proxy at both projects the same:

private readonly ProxyServer _proxyServer = new ProxyServer();

public void ProxyStart()
{
    var explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000);
    _proxyServer.AddEndPoint(explicitEndPoint);
    _proxyServer.Start();
    _proxyServer.SetAsSystemProxy(explicitEndPoint , ProxyProtocolType.AllHttp);
}

Solution

  • Thanks for the help, you are prompted me to solve this issue. Problem was that Titanium-web-proxy (3.0.503) generate new cert each time, So I am just set root cert by manual and it helps. Tests launching without the security warning.

      ProxyServer.CertificateManager.RootCertificate = new X509Certificate2(path + "\\Resources\\rootCert.pfx");