Class MockHttpTransport (1.45.0)

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
Name Description
builder MockHttpTransport.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
Name Description
method String
url String
Returns
Type Description
LowLevelHttpRequest
Overrides
Exceptions
Type Description
IOException

getLowLevelHttpRequest()

public final MockLowLevelHttpRequest getLowLevelHttpRequest()

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

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

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

Parameter
Name Description
method String
Returns
Type Description
boolean
Overrides
Exceptions
Type Description
IOException