Class MockHttpClient (1.42.3)

Stay organized with collections Save and categorize content based on your preferences.
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
NameDescription
requestExecorg.apache.http.protocol.HttpRequestExecutor
conmanorg.apache.http.conn.ClientConnectionManager
reustratorg.apache.http.ConnectionReuseStrategy
kastratorg.apache.http.conn.ConnectionKeepAliveStrategy
rouplanorg.apache.http.conn.routing.HttpRoutePlanner
httpProcessororg.apache.http.protocol.HttpProcessor
retryHandlerorg.apache.http.client.HttpRequestRetryHandler
redirectHandlerorg.apache.http.client.RedirectHandler
targetAuthHandlerorg.apache.http.client.AuthenticationHandler
proxyAuthHandlerorg.apache.http.client.AuthenticationHandler
stateHandlerorg.apache.http.client.UserTokenHandler
paramsorg.apache.http.params.HttpParams
Returns
TypeDescription
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
TypeDescription
int

setResponseCode(int responseCode)

public MockHttpClient setResponseCode(int responseCode)

Sets the HTTP response code to use.

Parameter
NameDescription
responseCodeint
Returns
TypeDescription
MockHttpClient