Removed calls to deprecated methods

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@930351 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2010-04-02 18:39:50 +00:00
parent 8b65aa4945
commit 0be39371e9
2 changed files with 15 additions and 5 deletions

View File

@ -161,7 +161,7 @@ public void testCreateSocket() throws Exception {
SSLContext sslcontext = SSLContext.getInstance("TLSv1");
sslcontext.init(keymanagers, trustmanagers, null);
LocalTestServer server = new LocalTestServer(null, null, null, sslcontext);
LocalTestServer server = new LocalTestServer(null, null, null, null, sslcontext);
server.registerDefaultHandlers();
server.start();
try {

View File

@ -42,6 +42,7 @@
import org.apache.http.ConnectionReuseStrategy;
import org.apache.http.HttpException;
import org.apache.http.HttpResponseFactory;
import org.apache.http.HttpServerConnection;
import org.apache.http.impl.DefaultConnectionReuseStrategy;
import org.apache.http.impl.DefaultHttpResponseFactory;
@ -82,6 +83,9 @@ public class LocalTestServer {
/** The server-side connection re-use strategy. */
private final ConnectionReuseStrategy reuseStrategy;
/** The response factory */
private final HttpResponseFactory responseFactory;
/**
* The HTTP processor.
* If the interceptors are thread safe and the list is not
@ -124,11 +128,13 @@ public class LocalTestServer {
public LocalTestServer(
BasicHttpProcessor proc,
ConnectionReuseStrategy reuseStrat,
HttpResponseFactory responseFactory,
HttpParams params,
SSLContext sslcontext) {
super();
this.handlerRegistry = new HttpRequestHandlerRegistry();
this.reuseStrategy = (reuseStrat != null) ? reuseStrat: newConnectionReuseStrategy();
this.responseFactory = (responseFactory != null) ? responseFactory: newHttpResponseFactory();
this.httpProcessor = (proc != null) ? proc : newProcessor();
this.serverParams = (params != null) ? params : newDefaultParams();
this.sslcontext = sslcontext;
@ -148,7 +154,7 @@ public LocalTestServer(
public LocalTestServer(
BasicHttpProcessor proc,
HttpParams params) {
this(proc, null, params, null);
this(proc, null, null, params, null);
}
/**
@ -193,6 +199,9 @@ protected ConnectionReuseStrategy newConnectionReuseStrategy() {
return new DefaultConnectionReuseStrategy();
}
protected HttpResponseFactory newHttpResponseFactory() {
return new DefaultHttpResponseFactory();
}
/**
* Returns the number of connections this test server has accepted.
@ -394,9 +403,10 @@ protected void accept() throws IOException {
HttpService httpService = new HttpService(
httpProcessor,
reuseStrategy,
new DefaultHttpResponseFactory());
httpService.setParams(serverParams);
httpService.setHandlerResolver(handlerRegistry);
responseFactory,
handlerRegistry,
null,
serverParams);
// Start worker thread
Thread t = new Thread(new Worker(httpService, conn));