Small updates to ProxyServletTest.
This commit is contained in:
parent
c449f1fa20
commit
968ed9f0ae
|
@ -173,7 +173,10 @@ public class ProxyServletTest
|
||||||
|
|
||||||
private HttpClient prepareClient() throws Exception
|
private HttpClient prepareClient() throws Exception
|
||||||
{
|
{
|
||||||
|
QueuedThreadPool clientPool = new QueuedThreadPool();
|
||||||
|
clientPool.setName("client");
|
||||||
HttpClient result = new HttpClient();
|
HttpClient result = new HttpClient();
|
||||||
|
result.setExecutor(clientPool);
|
||||||
result.getProxyConfiguration().getProxies().add(new HttpProxy("localhost", proxyConnector.getLocalPort()));
|
result.getProxyConfiguration().getProxies().add(new HttpProxy("localhost", proxyConnector.getLocalPort()));
|
||||||
result.start();
|
result.start();
|
||||||
return result;
|
return result;
|
||||||
|
@ -305,8 +308,19 @@ public class ProxyServletTest
|
||||||
@Override
|
@Override
|
||||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
|
||||||
{
|
{
|
||||||
if (req.getHeader("Via") != null)
|
try
|
||||||
resp.addHeader(PROXIED_HEADER, "true");
|
{
|
||||||
|
// Give some time to the proxy to
|
||||||
|
// upload the content to the server.
|
||||||
|
Thread.sleep(1000);
|
||||||
|
|
||||||
|
if (req.getHeader("Via") != null)
|
||||||
|
resp.addHeader(PROXIED_HEADER, "true");
|
||||||
|
}
|
||||||
|
catch (InterruptedException x)
|
||||||
|
{
|
||||||
|
throw new InterruptedIOException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
startProxy();
|
startProxy();
|
||||||
|
|
Loading…
Reference in New Issue