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 BlockingStreamingHttpResponseFactoryblockingStreamingResponseFactory()Returns theBlockingStreamingHttpResponseFactoryassociated with thisHttpServiceContext.CompletablecloseAsync()Used to close/shutdown a resource.HttpExecutionContextexecutionContext()Get theExecutionContextfor thisConnectionInfo.HttpHeadersFactoryheadersFactory()Returns theHttpHeadersFactoryassociated with thisHttpServiceContext.java.net.SocketAddresslocalAddress()TheSocketAddressto which the associated connection is bound.CompletableonClose()Returns aCompletablethat is notified once theListenableAsyncCloseablewas closed.HttpProtocolVersionprotocol()Get theConnectionInfo.Protocolfor thisConnectionInfo.java.net.SocketAddressremoteAddress()TheSocketAddressto which the associated connection is connected.HttpResponseFactoryresponseFactory()Returns theHttpResponseFactoryassociated with thisHttpServiceContext.<T> TsocketOption(java.net.SocketOption<T> option)javax.net.ssl.SSLSessionsslSession()Get theSSLSessionfor this connection.StreamingHttpResponseFactorystreamingResponseFactory()Returns theStreamingHttpResponseFactoryassociated 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:HttpServiceContextReturns theHttpHeadersFactoryassociated with thisHttpServiceContext.- Overrides:
headersFactoryin classHttpServiceContext- Returns:
HttpHeadersFactoryassociated with thisHttpServiceContext.
-
responseFactory
public HttpResponseFactory responseFactory()
Description copied from class:HttpServiceContextReturns theHttpResponseFactoryassociated with thisHttpServiceContext.- Overrides:
responseFactoryin classHttpServiceContext- Returns:
HttpResponseFactoryassociated with thisHttpServiceContext.
-
streamingResponseFactory
public StreamingHttpResponseFactory streamingResponseFactory()
Description copied from class:HttpServiceContextReturns theStreamingHttpResponseFactoryassociated with thisHttpServiceContext.- Overrides:
streamingResponseFactoryin classHttpServiceContext- Returns:
StreamingHttpResponseFactoryassociated with thisHttpServiceContext.
-
blockingStreamingResponseFactory
public BlockingStreamingHttpResponseFactory blockingStreamingResponseFactory()
Description copied from class:HttpServiceContextReturns theBlockingStreamingHttpResponseFactoryassociated with thisHttpServiceContext.- Overrides:
blockingStreamingResponseFactoryin classHttpServiceContext- Returns:
BlockingStreamingHttpResponseFactoryassociated with thisHttpServiceContext.
-
localAddress
public java.net.SocketAddress localAddress()
Description copied from interface:ConnectionInfoTheSocketAddressto which the associated connection is bound.- Returns:
- The
SocketAddressto which the associated connection is bound.
-
remoteAddress
public java.net.SocketAddress remoteAddress()
Description copied from interface:ConnectionInfoTheSocketAddressto which the associated connection is connected.- Returns:
- The
SocketAddressto which the associated connection is connected.
-
sslSession
@Nullable public javax.net.ssl.SSLSession sslSession()
Description copied from interface:ConnectionInfoGet theSSLSessionfor this connection.- Returns:
- The
SSLSessionif SSL/TLS is enabled, ornullotherwise.
-
executionContext
public HttpExecutionContext executionContext()
Description copied from interface:ConnectionInfoGet theExecutionContextfor 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 specificIoExecutorhas been selected.- Returns:
- the
ExecutionContextfor thisConnectionInfo.
-
socketOption
@Nullable public <T> T socketOption(java.net.SocketOption<T> option)
Description copied from interface:ConnectionInfo- Type Parameters:
T- the type of theSocketOptionvalue.- Parameters:
option-SocketOptionto get.- Returns:
- the
SocketOptionvalue of typeTfor thisConnectionInfoornullif thisSocketOptionis not supported by thisConnectionInfo. - See Also:
StandardSocketOptions,ServiceTalkSocketOptions
-
protocol
public HttpProtocolVersion protocol()
Description copied from interface:ConnectionInfoGet theConnectionInfo.Protocolfor thisConnectionInfo.- Returns:
- the
ConnectionInfo.Protocolfor thisConnectionInfo.
-
onClose
public Completable onClose()
Description copied from interface:ListenableAsyncCloseableReturns aCompletablethat is notified once theListenableAsyncCloseablewas closed.- Returns:
- the
Completablethat is notified on close.
-
closeAsync
public Completable closeAsync()
Description copied from interface:AsyncCloseableUsed to close/shutdown a resource.- Returns:
- A
Completablethat is notified once the close is complete.
-
-