Package io.servicetalk.http.api
Class TestHttpServiceContext
- java.lang.Object
-
- io.servicetalk.http.api.HttpServiceContext
-
- io.servicetalk.http.api.TestHttpServiceContext
-
- All Implemented Interfaces:
AsyncCloseable
,ListenableAsyncCloseable
,HttpConnectionContext
,ConnectionContext
,ConnectionInfo
public class TestHttpServiceContext extends HttpServiceContext
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.servicetalk.transport.api.ConnectionInfo
ConnectionInfo.Protocol
-
-
Constructor Summary
Constructors Constructor Description TestHttpServiceContext(HttpHeadersFactory headersFactory, StreamingHttpRequestResponseFactory reqRespFactory, HttpExecutionContext executionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BlockingStreamingHttpResponseFactory
blockingStreamingResponseFactory()
Returns theBlockingStreamingHttpResponseFactory
associated with thisHttpServiceContext
.Completable
closeAsync()
Used to close/shutdown a resource.HttpExecutionContext
executionContext()
Get theExecutionContext
for thisConnectionInfo
.HttpHeadersFactory
headersFactory()
Returns theHttpHeadersFactory
associated with thisHttpServiceContext
.java.net.SocketAddress
localAddress()
TheSocketAddress
to which the associated connection is bound.Completable
onClose()
Returns aCompletable
that is notified once theListenableAsyncCloseable
was closed.HttpProtocolVersion
protocol()
Get theConnectionInfo.Protocol
for thisConnectionInfo
.java.net.SocketAddress
remoteAddress()
TheSocketAddress
to which the associated connection is connected.HttpResponseFactory
responseFactory()
Returns theHttpResponseFactory
associated with thisHttpServiceContext
.<T> T
socketOption(java.net.SocketOption<T> option)
javax.net.ssl.SSLSession
sslSession()
Get theSSLSession
for this connection.StreamingHttpResponseFactory
streamingResponseFactory()
Returns theStreamingHttpResponseFactory
associated with thisHttpServiceContext
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsyncGracefully
-
-
-
-
Constructor Detail
-
TestHttpServiceContext
public TestHttpServiceContext(HttpHeadersFactory headersFactory, StreamingHttpRequestResponseFactory reqRespFactory, HttpExecutionContext executionContext)
-
-
Method Detail
-
headersFactory
public HttpHeadersFactory headersFactory()
Description copied from class:HttpServiceContext
Returns theHttpHeadersFactory
associated with thisHttpServiceContext
.- Overrides:
headersFactory
in classHttpServiceContext
- Returns:
HttpHeadersFactory
associated with thisHttpServiceContext
.
-
responseFactory
public HttpResponseFactory responseFactory()
Description copied from class:HttpServiceContext
Returns theHttpResponseFactory
associated with thisHttpServiceContext
.- Overrides:
responseFactory
in classHttpServiceContext
- Returns:
HttpResponseFactory
associated with thisHttpServiceContext
.
-
streamingResponseFactory
public StreamingHttpResponseFactory streamingResponseFactory()
Description copied from class:HttpServiceContext
Returns theStreamingHttpResponseFactory
associated with thisHttpServiceContext
.- Overrides:
streamingResponseFactory
in classHttpServiceContext
- Returns:
StreamingHttpResponseFactory
associated with thisHttpServiceContext
.
-
blockingStreamingResponseFactory
public BlockingStreamingHttpResponseFactory blockingStreamingResponseFactory()
Description copied from class:HttpServiceContext
Returns theBlockingStreamingHttpResponseFactory
associated with thisHttpServiceContext
.- Overrides:
blockingStreamingResponseFactory
in classHttpServiceContext
- Returns:
BlockingStreamingHttpResponseFactory
associated with thisHttpServiceContext
.
-
localAddress
public java.net.SocketAddress localAddress()
Description copied from interface:ConnectionInfo
TheSocketAddress
to which the associated connection is bound.- Returns:
- The
SocketAddress
to which the associated connection is bound.
-
remoteAddress
public java.net.SocketAddress remoteAddress()
Description copied from interface:ConnectionInfo
TheSocketAddress
to which the associated connection is connected.- Returns:
- The
SocketAddress
to which the associated connection is connected.
-
sslSession
@Nullable public javax.net.ssl.SSLSession sslSession()
Description copied from interface:ConnectionInfo
Get theSSLSession
for this connection.- Returns:
- The
SSLSession
if SSL/TLS is enabled, ornull
otherwise.
-
executionContext
public HttpExecutionContext executionContext()
Description copied from interface:ConnectionInfo
Get theExecutionContext
for thisConnectionInfo
.The
ExecutionContext.ioExecutor()
will represent the thread responsible for IO for thisConnectionInfo
. Note that this maybe different that what was used to create this object because at this time a specificIoExecutor
has been selected.- Returns:
- the
ExecutionContext
for thisConnectionInfo
.
-
socketOption
@Nullable public <T> T socketOption(java.net.SocketOption<T> option)
Description copied from interface:ConnectionInfo
- Type Parameters:
T
- the type of theSocketOption
value.- Parameters:
option
-SocketOption
to get.- Returns:
- the
SocketOption
value of typeT
for thisConnectionInfo
ornull
if thisSocketOption
is not supported by thisConnectionInfo
. - See Also:
StandardSocketOptions
,ServiceTalkSocketOptions
-
protocol
public HttpProtocolVersion protocol()
Description copied from interface:ConnectionInfo
Get theConnectionInfo.Protocol
for thisConnectionInfo
.- Returns:
- the
ConnectionInfo.Protocol
for thisConnectionInfo
.
-
onClose
public Completable onClose()
Description copied from interface:ListenableAsyncCloseable
Returns aCompletable
that is notified once theListenableAsyncCloseable
was closed.- Returns:
- the
Completable
that is notified on close.
-
closeAsync
public Completable closeAsync()
Description copied from interface:AsyncCloseable
Used to close/shutdown a resource.- Returns:
- A
Completable
that is notified once the close is complete.
-
-