Class MockHttpClient (1.45.1)

public class MockHttpClient extends DefaultHttpClient

Beta
Mock for HttpClient that does not actually make any network calls.

Implementation is not thread-safe.

Inheritance

java.lang.Object > org.apache.http.impl.client.CloseableHttpClient > org.apache.http.impl.client.AbstractHttpClient > org.apache.http.impl.client.DefaultHttpClient > MockHttpClient

Constructors

MockHttpClient()

public MockHttpClient()

Methods

createClientRequestDirector(HttpRequestExecutor requestExec, ClientConnectionManager conman, ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectHandler redirectHandler, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler stateHandler, HttpParams params)

protected RequestDirector createClientRequestDirector(HttpRequestExecutor requestExec, ClientConnectionManager conman, ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectHandler redirectHandler, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler stateHandler, HttpParams params)
Parameters
Name Description
requestExec org.apache.http.protocol.HttpRequestExecutor
conman org.apache.http.conn.ClientConnectionManager
reustrat org.apache.http.ConnectionReuseStrategy
kastrat org.apache.http.conn.ConnectionKeepAliveStrategy
rouplan org.apache.http.conn.routing.HttpRoutePlanner
httpProcessor org.apache.http.protocol.HttpProcessor
retryHandler org.apache.http.client.HttpRequestRetryHandler
redirectHandler org.apache.http.client.RedirectHandler
targetAuthHandler org.apache.http.client.AuthenticationHandler
proxyAuthHandler org.apache.http.client.AuthenticationHandler
stateHandler org.apache.http.client.UserTokenHandler
params org.apache.http.params.HttpParams
Returns
Type Description
org.apache.http.client.RequestDirector
Overrides
org.apache.http.impl.client.AbstractHttpClient.createClientRequestDirector(org.apache.http.protocol.HttpRequestExecutor,org.apache.http.conn.ClientConnectionManager,org.apache.http.ConnectionReuseStrategy,org.apache.http.conn.ConnectionKeepAliveStrategy,org.apache.http.conn.routing.HttpRoutePlanner,org.apache.http.protocol.HttpProcessor,org.apache.http.client.HttpRequestRetryHandler,org.apache.http.client.RedirectHandler,org.apache.http.client.AuthenticationHandler,org.apache.http.client.AuthenticationHandler,org.apache.http.client.UserTokenHandler,org.apache.http.params.HttpParams)

getResponseCode()

public final int getResponseCode()

Returns the HTTP response code to use.

Returns
Type Description
int

setResponseCode(int responseCode)

public MockHttpClient setResponseCode(int responseCode)

Sets the HTTP response code to use.

Parameter
Name Description
responseCode int
Returns
Type Description
MockHttpClient