Search in sources :

Example 1 with ProxyServer

use of com.ning.http.client.ProxyServer in project sonatype-aether by sonatype.

the class AsyncRepositoryConnector method getProxy.

private ProxyServer getProxy(RemoteRepository repository, String credentialEncoding) {
    ProxyServer proxyServer = null;
    Proxy p = repository.getProxy();
    if (p != null) {
        Authentication a = p.getAuthentication();
        boolean useSSL = repository.getProtocol().equalsIgnoreCase("https") || repository.getProtocol().equalsIgnoreCase("dav:https");
        if (a == null) {
            proxyServer = new ProxyServer(useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort());
        } else {
            proxyServer = new ProxyServer(useSSL ? Protocol.HTTPS : Protocol.HTTP, p.getHost(), p.getPort(), a.getUsername(), a.getPassword());
            proxyServer.setEncoding(credentialEncoding);
        }
    }
    return proxyServer;
}
Also used : Proxy(org.sonatype.aether.repository.Proxy) Authentication(org.sonatype.aether.repository.Authentication) ProxyServer(com.ning.http.client.ProxyServer)

Aggregations

ProxyServer (com.ning.http.client.ProxyServer)1 Authentication (org.sonatype.aether.repository.Authentication)1 Proxy (org.sonatype.aether.repository.Proxy)1