public final class MockHttpClient extends Object implements SdkHttpClient
SdkHttpClient.| Constructor and Description |
|---|
MockHttpClient() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
<T> Optional<T> |
getConfigurationValue(SdkHttpConfigurationOption<T> key)
Retrieve the current value of the configuration option, if present.
|
SdkHttpFullRequest |
getLastRequest() |
AbortableCallable<SdkHttpFullResponse> |
prepareRequest(SdkHttpFullRequest request,
SdkRequestContext requestContext)
Create a
AbortableCallable that can be used to execute the HTTP request. |
void |
reset()
Resets this mock by clearing any captured requests and wiping any stubbed responses.
|
void |
stubNextResponse(SdkHttpFullResponse nextResponse)
Sets up the next HTTP response that will be returned by the mock.
|
public AbortableCallable<SdkHttpFullResponse> prepareRequest(SdkHttpFullRequest request, SdkRequestContext requestContext)
SdkHttpClientAbortableCallable that can be used to execute the HTTP request.prepareRequest in interface SdkHttpClientrequest - Representation of an HTTP request.requestContext - Contains any extra dependencies needed.public <T> Optional<T> getConfigurationValue(SdkHttpConfigurationOption<T> key)
ConfigurationProvidergetConfigurationValue in interface ConfigurationProviderT - Type of configuration value.key - Key of configuration value to retrieve.Optional if configuration option is not supported, otherwise a fulfilled Optional containing the current value.public void close()
SdkAutoCloseableclose in interface AutoCloseableclose in interface SdkAutoCloseablepublic void reset()
public void stubNextResponse(SdkHttpFullResponse nextResponse)
nextResponse - Next SdkHttpFullResponse to return from
prepareRequest(SdkHttpFullRequest, SdkRequestContext)public SdkHttpFullRequest getLastRequest()
IllegalStateException - If no requests have been captured.Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.