org.littleshoot.proxy.extras.SelfSignedSslEngineSource Java Examples

The following examples show how to use org.littleshoot.proxy.extras.SelfSignedSslEngineSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CliProxyEnvVarIT.java    From digdag with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp()
        throws Exception
{
    httpMockServer = new MockWebServer();
    httpMockServer.start();

    httpsMockServer = new MockWebServer();
    HandshakeCertificates handshakeCertificates = localhost();
    SSLSocketFactory socketFactory = handshakeCertificates.sslSocketFactory();


    httpsMockServer.useHttps(socketFactory, false);
    httpsMockServer.start();

    httpProxy = DefaultHttpProxyServer
            .bootstrap()
            .withPort(0)
            .plusActivityTracker(httpProxyRequestTracker)
            .start();
    httpProxyUrl = "http://" + httpProxy.getListenAddress().getHostString() + ":" + httpProxy.getListenAddress().getPort();

    httpsProxy = DefaultHttpProxyServer
            .bootstrap()
            .withPort(0)
            .plusActivityTracker(httpsProxyRequestTracker)
            .withSslEngineSource(new SelfSignedSslEngineSource())
            .withAuthenticateSslClients(false)
            .start();
    httpsProxyUrl = "https://" + httpsProxy.getListenAddress().getHostString() + ":" + httpsProxy.getListenAddress().getPort();
}