use of org.littleshoot.proxy.ChainedProxyManager in project jbossws-cxf by jbossws.
the class HTTPProxyTestCaseForked method initProxyServer.
private void initProxyServer() throws Exception {
org.littleshoot.proxy.ProxyAuthenticator proxyAuthenticator = new org.littleshoot.proxy.ProxyAuthenticator() {
@Override
public boolean authenticate(String user, String pwd) {
return (PROXY_USER.equals(user) && PROXY_PWD.equals(pwd));
}
};
InetSocketAddress address = new InetSocketAddress(getServerHost(), ++proxyPort);
ChainedProxyManager chainProxyManager = new ChainedProxyManager() {
@Override
public void lookupChainedProxies(HttpRequest httpRequest, Queue<ChainedProxy> chainedProxies) {
chainedProxies.add(new ChainedProxyAdapter() {
@Override
public InetSocketAddress getChainedProxyAddress() {
return new InetSocketAddress(getServerHost(), getServerPort());
}
});
}
};
proxyServer = org.littleshoot.proxy.impl.DefaultHttpProxyServer.bootstrap().withChainProxyManager(chainProxyManager).withAddress(address).withProxyAuthenticator(proxyAuthenticator).start();
}
Aggregations