Class ApacheHttpClient
java.lang.Object
com.github.mjeanroy.junit.servers.client.impl.AbstractHttpClient
com.github.mjeanroy.junit.servers.client.impl.apache.ApacheHttpClient
- All Implemented Interfaces:
HttpClient
Implementation of
HttpClient
using apache http client
library under the hood.-
Method Summary
Modifier and TypeMethodDescriptionprotected HttpRequest
buildRequest
(HttpMethod httpMethod, HttpUrl endpoint) Build request object.static ApacheHttpClient
defaultApacheHttpClient
(EmbeddedServer<?> server) Create new http client using default internal client.void
Effectively destroy HTTP Client.boolean
Check that HTTP client has been destroyed.static ApacheHttpClient
newApacheHttpClient
(HttpClientConfiguration configuration, EmbeddedServer<?> server) Create new http client using custom configuration.toString()
Methods inherited from class com.github.mjeanroy.junit.servers.client.impl.AbstractHttpClient
destroy, finalize, getConfiguration, getServer, prepareDelete, prepareGet, prepareHead, preparePatch, preparePatch, preparePost, preparePost, preparePut, preparePut, prepareRequest
-
Method Details
-
defaultApacheHttpClient
Create new http client using default internal client.- Parameters:
server
- Embedded server.- Returns:
- Http client.
- Throws:
NullPointerException
- Ifserver
isnull
.
-
newApacheHttpClient
public static ApacheHttpClient newApacheHttpClient(HttpClientConfiguration configuration, EmbeddedServer<?> server) Create new http client using custom configuration.- Parameters:
configuration
- Client configuration.server
- Embedded server.- Returns:
- Http client.
- Throws:
NullPointerException
- Ifserver
orconfiguration
arenull
.
-
buildRequest
Description copied from class:AbstractHttpClient
Build request object.- Specified by:
buildRequest
in classAbstractHttpClient
- Parameters:
httpMethod
- Http method.endpoint
- Request url.- Returns:
- Http request.
-
doDestroy
Description copied from class:AbstractHttpClient
Effectively destroy HTTP Client.- Specified by:
doDestroy
in classAbstractHttpClient
- Throws:
Exception
- If an error occurs while destroying client.
-
isDestroyed
public boolean isDestroyed()Description copied from interface:HttpClient
Check that HTTP client has been destroyed.- Specified by:
isDestroyed
in interfaceHttpClient
- Overrides:
isDestroyed
in classAbstractHttpClient
- Returns:
true
if client is closed,false
otherwise.
-
toString
-