public class MockHttpTransport extends HttpTransportBeta
Mock for HttpTransport.
Implementation is thread-safe. For maximum efficiency, applications should use a single globally-shared instance of the HTTP transport.
Constructors
MockHttpTransport()
public MockHttpTransport()MockHttpTransport(MockHttpTransport.Builder builder)
protected MockHttpTransport(MockHttpTransport.Builder builder)| Name | Description |
builder |
MockHttpTransport.Builderbuilder |
Methods
buildRequest(String method, String url)
public LowLevelHttpRequest buildRequest(String method, String url)Builds a low level HTTP request for the given HTTP method.
| Name | Description |
method |
String |
url |
String |
| Type | Description |
LowLevelHttpRequest |
| Type | Description |
IOException |
getLowLevelHttpRequest()
public final MockLowLevelHttpRequest getLowLevelHttpRequest()Returns the MockLowLevelHttpRequest that is associated with this Builder, or
null if no such instance exists.
| Type | Description |
MockLowLevelHttpRequest |
getSupportedMethods()
public final Set<String> getSupportedMethods()Returns the unmodifiable set of supported HTTP methods or null to specify that all
methods are supported.
| Type | Description |
Set<String> |
supportsMethod(String method)
public boolean supportsMethod(String method)Returns whether a specified HTTP method is supported by this transport.
Default implementation returns true if and only if the request method is "DELETE",
"GET", "POST", or "PUT". Subclasses should override.
| Name | Description |
method |
String |
| Type | Description |
boolean |
| Type | Description |
IOException |