Class NingAsyncHttpClient
java.lang.Object
com.github.mjeanroy.junit.servers.client.impl.AbstractHttpClient
com.github.mjeanroy.junit.servers.client.impl.ning.NingAsyncHttpClient
- All Implemented Interfaces:
HttpClient
Implementation of
HttpClient
using (Ning) async-http-client
under the hood.-
Method Summary
Modifier and TypeMethodDescriptionprotected HttpRequest
buildRequest
(HttpMethod httpMethod, HttpUrl endpoint) Build request object.static NingAsyncHttpClient
defaultAsyncHttpClient
(EmbeddedServer<?> server) Create new http client using internal http client from async-http-client library.protected void
Effectively destroy HTTP Client.boolean
Check that HTTP client has been destroyed.static NingAsyncHttpClient
newAsyncHttpClient
(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
-
defaultAsyncHttpClient
Create new http client using internal http client from async-http-client library. An instance of {com.ning.http.client.NingAsyncHttpClient} will be automatically created.- Parameters:
server
- Embedded server.- Returns:
- Http client.
- Throws:
NullPointerException
- Ifserver
isnull
.
-
newAsyncHttpClient
public static NingAsyncHttpClient newAsyncHttpClient(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
isnull
.
-
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
protected void doDestroy()Description copied from class:AbstractHttpClient
Effectively destroy HTTP Client.- Specified by:
doDestroy
in classAbstractHttpClient
-
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
-