HTTPCLIENT-1239: Support for overridable DefaultHttpServerConnection in LocalTestServer
Contributed by Okke Harsta <oharsta at apache.org> git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1393540 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5f9ab2e161
commit
aa82dc28ee
|
@ -319,6 +319,19 @@ public class LocalTestServer {
|
|||
return (InetSocketAddress) ssock.getLocalSocketAddress();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of {@link DefaultHttpServerConnection} to be used
|
||||
* in the Worker thread.
|
||||
* <p>
|
||||
* This method can be overridden in a super class in order to provide
|
||||
* a different implementation of the {@link DefaultHttpServerConnection}.
|
||||
*
|
||||
* @return DefaultHttpServerConnection.
|
||||
*/
|
||||
protected DefaultHttpServerConnection createHttpServerConnection() {
|
||||
return new DefaultHttpServerConnection();
|
||||
}
|
||||
|
||||
/**
|
||||
* The request listener.
|
||||
* Accepts incoming connections and launches a service thread.
|
||||
|
@ -337,7 +350,7 @@ public class LocalTestServer {
|
|||
while (!interrupted()) {
|
||||
Socket socket = servicedSocket.accept();
|
||||
acceptedConnections.incrementAndGet();
|
||||
DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
|
||||
DefaultHttpServerConnection conn = createHttpServerConnection();
|
||||
conn.bind(socket, httpservice.getParams());
|
||||
// Start worker thread
|
||||
Worker worker = new Worker(conn);
|
||||
|
|
Loading…
Reference in New Issue