use of org.glassfish.jersey.client.HttpUrlConnectorProvider.ConnectionFactory in project openstack4j by ContainX.
the class ClientFactory method addProxy.
private static void addProxy(ClientConfig cc, Config config) {
if (config.getProxy() != null) {
HttpUrlConnectorProvider cp = new HttpUrlConnectorProvider();
cc.connectorProvider(cp);
final Proxy proxy = new Proxy(Type.HTTP, new InetSocketAddress(config.getProxy().getRawHost(), config.getProxy().getPort()));
cp.connectionFactory(new ConnectionFactory() {
@Override
public HttpURLConnection getConnection(URL url) throws IOException {
return (HttpURLConnection) url.openConnection(proxy);
}
});
}
}
Aggregations