Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2022-10-25 09:59:55 +02:00
commit 1119e8b509
No known key found for this signature in database
GPG Key ID: 1677D141BCF3584D
18 changed files with 83 additions and 52 deletions

View File

@ -659,7 +659,7 @@ public class HTTPClientDocs
// Add the new proxy to the list of proxies already registered.
ProxyConfiguration proxyConfig = httpClient.getProxyConfiguration();
proxyConfig.getProxies().add(proxy);
proxyConfig.addProxy(proxy);
ContentResponse response = httpClient.GET("http://domain.com/path");
// end::proxy[]
@ -684,7 +684,7 @@ public class HTTPClientDocs
// Proxy configuration.
ProxyConfiguration proxyConfig = httpClient.getProxyConfiguration();
HttpProxy proxy = new HttpProxy("proxy.net", 8080);
proxyConfig.getProxies().add(proxy);
proxyConfig.addProxy(proxy);
ContentResponse response = httpClient.newRequest(serverURI).send();
// end::proxyAuthentication[]

View File

@ -54,7 +54,7 @@ public class WebSocketClientDocs
// Instantiate and configure HttpClient.
HttpClient httpClient = new HttpClient();
// For example, configure a proxy.
httpClient.getProxyConfiguration().getProxies().add(new HttpProxy("localhost", 8888));
httpClient.getProxyConfiguration().addProxy(new HttpProxy("localhost", 8888));
// Instantiate WebSocketClient, passing HttpClient to the constructor.
WebSocketClient webSocketClient = new WebSocketClient(httpClient);

View File

@ -14,13 +14,14 @@
package org.eclipse.jetty.client;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import org.eclipse.jetty.http.HttpScheme;
import org.eclipse.jetty.io.ClientConnectionFactory;
import org.eclipse.jetty.util.BlockingArrayQueue;
import org.eclipse.jetty.util.HostPort;
import org.eclipse.jetty.util.ssl.SslContextFactory;
@ -30,23 +31,50 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
* Applications add subclasses of {@link Proxy} to this configuration via:
* <pre>
* ProxyConfiguration proxyConfig = httpClient.getProxyConfiguration();
* proxyConfig.getProxies().add(new HttpProxy(proxyHost, 8080));
* proxyConfig.addProxy(new HttpProxy(proxyHost, 8080));
* </pre>
*
* @see HttpClient#getProxyConfiguration()
*/
public class ProxyConfiguration
{
private final List<Proxy> proxies = new ArrayList<>();
private final List<Proxy> proxies = new BlockingArrayQueue<>();
/**
* @deprecated use {@link #addProxy(Proxy)} and {@link #removeProxy(Proxy)} instead
* @return the forward proxies to use
*/
@Deprecated(forRemoval = true)
public List<Proxy> getProxies()
{
return proxies;
}
/**
* Adds a proxy.
*
* @param proxy a proxy
* @throws NullPointerException if {@code proxy} is null
*/
public void addProxy(Proxy proxy)
{
proxies.add(Objects.requireNonNull(proxy));
}
/**
* Removes a proxy.
*
* @param proxy a proxy
* @return true if a match is found
*/
public boolean removeProxy(Proxy proxy)
{
return proxies.remove(proxy);
}
public Proxy match(Origin origin)
{
for (Proxy proxy : getProxies())
for (Proxy proxy : proxies)
{
if (proxy.matches(origin))
return proxy;

View File

@ -95,7 +95,7 @@ public class HttpClientCustomProxyTest
// Setup the custom proxy
int proxyPort = connector.getLocalPort();
int serverPort = proxyPort + 1; // Any port will do for these tests - just not the same as the proxy
client.getProxyConfiguration().getProxies().add(new CAFEBABEProxy(new Origin.Address("localhost", proxyPort), false));
client.getProxyConfiguration().addProxy(new CAFEBABEProxy(new Origin.Address("localhost", proxyPort), false));
ContentResponse response = client.newRequest(serverHost, serverPort)
.timeout(5, TimeUnit.SECONDS)

View File

@ -231,7 +231,7 @@ public class HttpClientProxyProtocolTest
int proxyPort = connector.getLocalPort();
int serverPort = proxyPort + 1; // Any port will do.
client.getProxyConfiguration().getProxies().add(new HttpProxy("localhost", proxyPort));
client.getProxyConfiguration().addProxy(new HttpProxy("localhost", proxyPort));
// We are simulating to be a HttpClient inside a proxy.
// The server is configured with the PROXY protocol to know the socket address of clients.

View File

@ -57,7 +57,7 @@ public class HttpClientProxyTest extends AbstractHttpClientServerTest
int proxyPort = connector.getLocalPort();
int serverPort = proxyPort + 1; // Any port will do for these tests - just not the same as the proxy
client.getProxyConfiguration().getProxies().add(new HttpProxy("localhost", proxyPort));
client.getProxyConfiguration().addProxy(new HttpProxy("localhost", proxyPort));
ContentResponse response = client.newRequest(serverHost, serverPort)
.scheme(scenario.getScheme())
@ -104,7 +104,7 @@ public class HttpClientProxyTest extends AbstractHttpClientServerTest
String proxyHost = "localhost";
int proxyPort = connector.getLocalPort();
int serverPort = proxyPort + 1; // Any port will do for these tests - just not the same as the proxy
client.getProxyConfiguration().getProxies().add(new HttpProxy(proxyHost, proxyPort));
client.getProxyConfiguration().addProxy(new HttpProxy(proxyHost, proxyPort));
ContentResponse response1 = client.newRequest(serverHost, serverPort)
.scheme(scenario.getScheme())
@ -202,7 +202,7 @@ public class HttpClientProxyTest extends AbstractHttpClientServerTest
});
int proxyPort = connector.getLocalPort();
client.getProxyConfiguration().getProxies().add(new HttpProxy(proxyHost, proxyPort));
client.getProxyConfiguration().addProxy(new HttpProxy(proxyHost, proxyPort));
ContentResponse response1 = client.newRequest(serverHost, serverPort)
.scheme(scenario.getScheme())
@ -289,7 +289,7 @@ public class HttpClientProxyTest extends AbstractHttpClientServerTest
client.getAuthenticationStore().addAuthentication(new BasicAuthentication(proxyURI, proxyRealm, "proxyUser", "proxyPassword"));
URI serverURI = URI.create(scenario.getScheme() + "://" + serverHost + ":" + serverPort);
client.getAuthenticationStore().addAuthentication(new BasicAuthentication(serverURI, serverRealm, "serverUser", "serverPassword"));
client.getProxyConfiguration().getProxies().add(new HttpProxy(proxyHost, proxyPort));
client.getProxyConfiguration().addProxy(new HttpProxy(proxyHost, proxyPort));
final AtomicInteger requests = new AtomicInteger();
client.getRequestListeners().add(new Request.Listener.Adapter()
{
@ -359,7 +359,7 @@ public class HttpClientProxyTest extends AbstractHttpClientServerTest
int serverPort = proxyPort + 1;
URI proxyURI = URI.create(scenario.getScheme() + "://" + proxyHost + ":" + proxyPort);
client.getAuthenticationStore().addAuthentication(new BasicAuthentication(proxyURI, proxyRealm, "proxyUser", "proxyPassword"));
client.getProxyConfiguration().getProxies().add(new HttpProxy(proxyHost, proxyPort));
client.getProxyConfiguration().addProxy(new HttpProxy(proxyHost, proxyPort));
final AtomicInteger requests = new AtomicInteger();
client.getRequestListeners().add(new Request.Listener.Adapter()
{

View File

@ -77,7 +77,7 @@ public class Socks4ProxyTest
public void testSocks4Proxy() throws Exception
{
int proxyPort = proxy.socket().getLocalPort();
client.getProxyConfiguration().getProxies().add(new Socks4Proxy("localhost", proxyPort));
client.getProxyConfiguration().addProxy(new Socks4Proxy("localhost", proxyPort));
CountDownLatch latch = new CountDownLatch(1);
@ -139,7 +139,7 @@ public class Socks4ProxyTest
public void testSocks4ProxyWithSplitResponse() throws Exception
{
int proxyPort = proxy.socket().getLocalPort();
client.getProxyConfiguration().getProxies().add(new Socks4Proxy("localhost", proxyPort));
client.getProxyConfiguration().addProxy(new Socks4Proxy("localhost", proxyPort));
CountDownLatch latch = new CountDownLatch(1);
@ -215,7 +215,7 @@ public class Socks4ProxyTest
// The hostname must be that of the server, not of the proxy.
ssl.setHostnameVerifier((hostname, session) -> serverHost.equals(hostname));
});
client.getProxyConfiguration().getProxies().add(new Socks4Proxy(proxyHost, proxyPort));
client.getProxyConfiguration().addProxy(new Socks4Proxy(proxyHost, proxyPort));
CountDownLatch latch = new CountDownLatch(1);
client.newRequest(serverHost, serverPort)
@ -283,7 +283,7 @@ public class Socks4ProxyTest
{
String proxyHost = "localhost";
int proxyPort = proxy.socket().getLocalPort();
client.getProxyConfiguration().getProxies().add(new Socks4Proxy(proxyHost, proxyPort));
client.getProxyConfiguration().addProxy(new Socks4Proxy(proxyHost, proxyPort));
long timeout = 1000;
Request request = client.newRequest("localhost", proxyPort + 1)
@ -305,7 +305,7 @@ public class Socks4ProxyTest
{
String proxyHost = "localhost";
int proxyPort = proxy.socket().getLocalPort();
client.getProxyConfiguration().getProxies().add(new Socks4Proxy(proxyHost, proxyPort));
client.getProxyConfiguration().addProxy(new Socks4Proxy(proxyHost, proxyPort));
long idleTimeout = 1000;
client.setIdleTimeout(idleTimeout);
@ -327,7 +327,7 @@ public class Socks4ProxyTest
{
String proxyHost = "localhost";
int proxyPort = proxy.socket().getLocalPort();
client.getProxyConfiguration().getProxies().add(new Socks4Proxy(proxyHost, proxyPort));
client.getProxyConfiguration().addProxy(new Socks4Proxy(proxyHost, proxyPort));
Request request = client.newRequest("localhost", proxyPort + 1);
FutureResponseListener listener = new FutureResponseListener(request);

View File

@ -422,7 +422,7 @@ public class HttpClientTransportOverHTTP2Test extends AbstractTest
});
int proxyPort = connector.getLocalPort();
httpClient.getProxyConfiguration().getProxies().add(new HttpProxy(new Origin.Address("localhost", proxyPort), false, new Origin.Protocol(List.of("h2c"), false)));
httpClient.getProxyConfiguration().addProxy(new HttpProxy(new Origin.Address("localhost", proxyPort), false, new Origin.Protocol(List.of("h2c"), false)));
int serverPort = proxyPort + 1; // Any port will do, just not the same as the proxy.
ContentResponse response = httpClient.newRequest("localhost", serverPort)

View File

@ -257,7 +257,7 @@ public class ForwardProxyWithDynamicTransportTest
int proxyPort = proxySecure ? proxyTLSConnector.getLocalPort() : proxyConnector.getLocalPort();
Origin.Address proxyAddress = new Origin.Address("localhost", proxyPort);
HttpProxy proxy = new HttpProxy(proxyAddress, proxySecure, proxyProtocol);
client.getProxyConfiguration().getProxies().add(proxy);
client.getProxyConfiguration().addProxy(proxy);
String scheme = serverSecure ? "https" : "http";
int serverPort = serverSecure ? serverTLSConnector.getLocalPort() : serverConnector.getLocalPort();
@ -293,7 +293,7 @@ public class ForwardProxyWithDynamicTransportTest
int proxyPort = proxyConnector.getLocalPort();
Origin.Address proxyAddress = new Origin.Address("localhost", proxyPort);
HttpProxy proxy = new HttpProxy(proxyAddress, false, new Origin.Protocol(List.of("h2c"), false));
client.getProxyConfiguration().getProxies().add(proxy);
client.getProxyConfiguration().addProxy(proxy);
long idleTimeout = 1000;
http2Client.setStreamIdleTimeout(idleTimeout);
@ -334,7 +334,7 @@ public class ForwardProxyWithDynamicTransportTest
int proxyPort = proxyConnector.getLocalPort();
Origin.Address proxyAddress = new Origin.Address("localhost", proxyPort);
HttpProxy httpProxy = new HttpProxy(proxyAddress, false, new Origin.Protocol(List.of("h2c"), false));
client.getProxyConfiguration().getProxies().add(httpProxy);
client.getProxyConfiguration().addProxy(httpProxy);
proxy.stop();
CountDownLatch latch = new CountDownLatch(1);
@ -369,7 +369,7 @@ public class ForwardProxyWithDynamicTransportTest
int proxyPort = proxyConnector.getLocalPort();
Origin.Address proxyAddress = new Origin.Address("localhost", proxyPort);
HttpProxy httpProxy = new HttpProxy(proxyAddress, false, new Origin.Protocol(List.of("h2c"), false));
client.getProxyConfiguration().getProxies().add(httpProxy);
client.getProxyConfiguration().addProxy(httpProxy);
CountDownLatch latch = new CountDownLatch(1);
client.newRequest("localhost", serverConnector.getLocalPort())

View File

@ -585,7 +585,7 @@ public class HttpClientTransportDynamicTest
int proxyPort = connector.getLocalPort();
// The proxy speaks both http/1.1 and h2c.
Origin.Protocol proxyProtocol = new Origin.Protocol(List.of("http/1.1", "h2c"), false);
client.getProxyConfiguration().getProxies().add(new HttpProxy(new Origin.Address("localhost", proxyPort), false, proxyProtocol));
client.getProxyConfiguration().addProxy(new HttpProxy(new Origin.Address("localhost", proxyPort), false, proxyProtocol));
// Make an upgrade request from HTTP/1.1 to H2C.
int serverPort = proxyPort + 1; // Any port will do.

View File

@ -174,7 +174,7 @@ public class UnixDomainTest
ClientConnector clientConnector = ClientConnector.forUnixDomain(unixDomainPath);
HttpClient httpClient = new HttpClient(new HttpClientTransportDynamic(clientConnector));
httpClient.getProxyConfiguration().getProxies().add(new HttpProxy("localhost", fakeProxyPort));
httpClient.getProxyConfiguration().addProxy(new HttpProxy("localhost", fakeProxyPort));
httpClient.start();
try
{

View File

@ -205,7 +205,7 @@ public class ForwardProxyServerTest
ClientConnector clientConnector = new ClientConnector();
clientConnector.setSslContextFactory(clientTLS);
HttpClient httpClient = new HttpClient(new HttpClientTransportOverHTTP(clientConnector));
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.start();
try
@ -253,7 +253,7 @@ public class ForwardProxyServerTest
});
HttpClient httpClient = new HttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.start();
ContentResponse response = httpClient.newRequest("[::1]", serverConnector.getLocalPort())
@ -291,7 +291,7 @@ public class ForwardProxyServerTest
});
HttpClient httpClient = new HttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.start();
ContentResponse response = httpClient.newRequest("[::1]", serverConnector.getLocalPort())

View File

@ -198,7 +198,7 @@ public class ForwardProxyTLSServerTest
startProxy(proxyTLS);
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.start();
try
@ -233,7 +233,7 @@ public class ForwardProxyTLSServerTest
startProxy(proxyTLS);
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.start();
try
@ -280,7 +280,7 @@ public class ForwardProxyTLSServerTest
startProxy(proxyTLS);
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.start();
try
@ -365,7 +365,7 @@ public class ForwardProxyTLSServerTest
});
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
// Short idle timeout for HttpClient.
httpClient.setIdleTimeout(idleTimeout);
httpClient.start();
@ -403,7 +403,7 @@ public class ForwardProxyTLSServerTest
stopProxy();
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(new HttpProxy(new Origin.Address("localhost", proxyPort), proxySslContextFactory != null));
httpClient.getProxyConfiguration().addProxy(new HttpProxy(new Origin.Address("localhost", proxyPort), proxySslContextFactory != null));
httpClient.start();
ExecutionException x = assertThrows(ExecutionException.class, () ->
@ -431,7 +431,7 @@ public class ForwardProxyTLSServerTest
startProxy(proxyTLS);
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.start();
assertThrows(ExecutionException.class, () ->
@ -463,7 +463,7 @@ public class ForwardProxyTLSServerTest
});
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.start();
assertThrows(ExecutionException.class, () ->
@ -486,7 +486,7 @@ public class ForwardProxyTLSServerTest
HttpClient httpClient = newHttpClient();
HttpProxy httpProxy = new HttpProxy(new Origin.Address("[::1]", proxyConnector.getLocalPort()), proxyTLS != null);
httpClient.getProxyConfiguration().getProxies().add(httpProxy);
httpClient.getProxyConfiguration().addProxy(httpProxy);
httpClient.start();
try
@ -619,7 +619,7 @@ public class ForwardProxyTLSServerTest
HttpProxy httpProxy = newHttpProxy();
if (includeAddress)
httpProxy.getIncludedAddresses().add("localhost:" + serverConnector.getLocalPort());
httpClient.getProxyConfiguration().getProxies().add(httpProxy);
httpClient.getProxyConfiguration().addProxy(httpProxy);
URI uri = URI.create((proxySslContextFactory == null ? "http" : "https") + "://localhost:" + proxyConnector.getLocalPort());
httpClient.getAuthenticationStore().addAuthentication(new BasicAuthentication(uri, realm, "proxyUser", "proxyPassword"));
httpClient.start();
@ -700,7 +700,7 @@ public class ForwardProxyTLSServerTest
clientConnector.setSelectors(1);
clientConnector.setSslContextFactory(clientSslContextFactory);
HttpClient httpClient = new HttpClient(new HttpClientTransportOverHTTP(clientConnector));
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.start();
try
@ -771,7 +771,7 @@ public class ForwardProxyTLSServerTest
proxyClientTLS.setEndpointIdentificationAlgorithm(null);
proxyClientTLS.start();
HttpProxy httpProxy = new HttpProxy(new Origin.Address("localhost", proxyConnector.getLocalPort()), proxyClientTLS);
httpClient.getProxyConfiguration().getProxies().add(httpProxy);
httpClient.getProxyConfiguration().addProxy(httpProxy);
httpClient.start();
try
@ -802,7 +802,7 @@ public class ForwardProxyTLSServerTest
startProxy(proxyTLS);
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.start();
try
@ -851,7 +851,7 @@ public class ForwardProxyTLSServerTest
});
startProxy(proxyTLS);
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.setConnectTimeout(timeout);
httpClient.setIdleTimeout(4 * timeout);
httpClient.start();
@ -887,7 +887,7 @@ public class ForwardProxyTLSServerTest
});
startProxy(proxyTLS);
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.setConnectTimeout(timeout);
// Short idle timeout for HttpClient.
httpClient.setIdleTimeout(timeout);
@ -926,7 +926,7 @@ public class ForwardProxyTLSServerTest
}
});
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(newHttpProxy());
httpClient.getProxyConfiguration().addProxy(newHttpProxy());
httpClient.setConnectTimeout(timeout);
httpClient.setIdleTimeout(10 * timeout);
httpClient.start();
@ -975,7 +975,7 @@ public class ForwardProxyTLSServerTest
}
HttpClient httpClient = newHttpClient();
httpClient.getProxyConfiguration().getProxies().add(new HttpProxy(proxyHost, proxyPort));
httpClient.getProxyConfiguration().addProxy(new HttpProxy(proxyHost, proxyPort));
httpClient.start();
try

View File

@ -40,7 +40,7 @@ public class ProxyServerTest extends AbstractEmbeddedTest
server.start();
URI uri = server.getURI();
client.getProxyConfiguration().getProxies().add(new HttpProxy("localhost", uri.getPort()));
client.getProxyConfiguration().addProxy(new HttpProxy("localhost", uri.getPort()));
}
@AfterEach

View File

@ -153,7 +153,7 @@ public class AsyncMiddleManServletTest
clientPool.setName("client");
client = new HttpClient();
client.setExecutor(clientPool);
client.getProxyConfiguration().getProxies().add(new HttpProxy("localhost", proxyConnector.getLocalPort()));
client.getProxyConfiguration().addProxy(new HttpProxy("localhost", proxyConnector.getLocalPort()));
client.start();
}

View File

@ -116,7 +116,7 @@ public class ProxyServletFailureTest
QueuedThreadPool executor = new QueuedThreadPool();
executor.setName("client");
result.setExecutor(executor);
result.getProxyConfiguration().getProxies().add(new HttpProxy("localhost", proxyConnector.getLocalPort()));
result.getProxyConfiguration().addProxy(new HttpProxy("localhost", proxyConnector.getLocalPort()));
result.start();
return result;
}

View File

@ -109,7 +109,7 @@ public class ProxyServletLoadTest
clientPool.setName("client");
HttpClient result = new HttpClient();
result.setExecutor(clientPool);
result.getProxyConfiguration().getProxies().add(new HttpProxy("localhost", proxyConnector.getLocalPort()));
result.getProxyConfiguration().addProxy(new HttpProxy("localhost", proxyConnector.getLocalPort()));
result.start();
client = result;
}

View File

@ -62,6 +62,7 @@ import org.eclipse.jetty.client.ConnectionPool;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.HttpDestination;
import org.eclipse.jetty.client.HttpProxy;
import org.eclipse.jetty.client.ProxyConfiguration.Proxy;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.api.Response;
@ -123,6 +124,7 @@ public class ProxyServletTest
}
private HttpClient client;
private Proxy clientProxy;
private Server proxy;
private ServerConnector proxyConnector;
private ServletContextHandler proxyContext;
@ -197,6 +199,7 @@ public class ProxyServletTest
private void startClient(Consumer<HttpClient> consumer) throws Exception
{
clientProxy = new HttpProxy("localhost", proxyConnector.getLocalPort());
client = prepareClient(consumer);
}
@ -206,7 +209,7 @@ public class ProxyServletTest
clientPool.setName("client");
HttpClient result = new HttpClient();
result.setExecutor(clientPool);
result.getProxyConfiguration().getProxies().add(new HttpProxy("localhost", proxyConnector.getLocalPort()));
result.getProxyConfiguration().addProxy(clientProxy);
if (consumer != null)
consumer.accept(result);
result.start();
@ -729,7 +732,7 @@ public class ProxyServletTest
startProxy(proxyServletClass);
startClient();
int port = serverConnector.getLocalPort();
client.getProxyConfiguration().getProxies().get(0).getExcludedAddresses().add("127.0.0.1:" + port);
clientProxy.getExcludedAddresses().add("127.0.0.1:" + port);
// Try with a proxied host
ContentResponse response = client.newRequest("localhost", port)