Search in sources :

Example 1 with ProxyServer

use of org.sonatype.jettytestsuite.ProxyServer in project tycho by eclipse.

the class ProxySupportTest method startHttpProxyServer.

private void startHttpProxyServer(boolean useAuthentication, String user, String password) throws Exception {
    proxyServer = new ProxyServer();
    proxyPort = findFreePort();
    proxyServer.setPort(proxyPort);
    proxyServer.initialize();
    Map<String, String> authMap = new HashMap<>();
    if (useAuthentication) {
        authMap.put(user, password);
    }
    proxyServlet = proxyServer.getProxyServlet();
    proxyServlet.setAuthentications(authMap);
    proxyServlet.setUseAuthentication(useAuthentication);
    proxyServer.start();
}
Also used : HashMap(java.util.HashMap) ProxyServer(org.sonatype.jettytestsuite.ProxyServer)

Aggregations

HashMap (java.util.HashMap)1 ProxyServer (org.sonatype.jettytestsuite.ProxyServer)1