Class MockHttpTransport (1.41.8)

public class MockHttpTransport extends HttpTransport

Beta
Mock for HttpTransport.

Implementation is thread-safe. For maximum efficiency, applications should use a single globally-shared instance of the HTTP transport.

Inheritance

java.lang.Object > HttpTransport > MockHttpTransport

Constructors

MockHttpTransport()

public MockHttpTransport()

MockHttpTransport(MockHttpTransport.Builder builder)

protected MockHttpTransport(MockHttpTransport.Builder builder)
Parameter
NameDescription
builderMockHttpTransport.Builder

builder

Methods

buildRequest(String method, String url)

public LowLevelHttpRequest buildRequest(String method, String url)

Builds a low level HTTP request for the given HTTP method.

Parameters
NameDescription
methodString
urlString
Returns
TypeDescription
LowLevelHttpRequest
Overrides Exceptions
TypeDescription
IOException

getLowLevelHttpRequest()

public final MockLowLevelHttpRequest getLowLevelHttpRequest()

Returns the MockLowLevelHttpRequest that is associated with this Builder, or null if no such instance exists.

Returns
TypeDescription
MockLowLevelHttpRequest

getSupportedMethods()

public final Set<String> getSupportedMethods()

Returns the unmodifiable set of supported HTTP methods or null to specify that all methods are supported.

Returns
TypeDescription
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.

Parameter
NameDescription
methodString
Returns
TypeDescription
boolean
Overrides Exceptions
TypeDescription
IOException