java.lang.AutoCloseable
, java.nio.channels.Channel
, java.io.Closeable
Http2ClientConnection
public interface ClientConnection
extends java.nio.channels.Channel
In general these objects are not thread safe, they should only be used by the IO thread that is responsible for the connection. As a result this client does not provide a mechanism to perform blocking IO, it is designed for async operation only.
Modifier and Type | Method | Description |
---|---|---|
void |
addCloseListener(org.xnio.ChannelListener<ClientConnection> listener) |
Adds a close listener, than will be invoked with the connection is closed
|
ByteBufferPool |
getBufferPool() |
|
org.xnio.ChannelListener.Setter<? extends ClientConnection> |
getCloseSetter() |
|
org.xnio.XnioIoThread |
getIoThread() |
|
java.net.SocketAddress |
getLocalAddress() |
|
<A extends java.net.SocketAddress> |
getLocalAddress(java.lang.Class<A> type) |
|
<T> T |
getOption(org.xnio.Option<T> option) |
|
java.net.SocketAddress |
getPeerAddress() |
|
<A extends java.net.SocketAddress> |
getPeerAddress(java.lang.Class<A> type) |
|
ClientStatistics |
getStatistics() |
|
org.xnio.XnioWorker |
getWorker() |
|
boolean |
isMultiplexingSupported() |
|
boolean |
isOpen() |
|
boolean |
isPushSupported() |
|
boolean |
isUpgraded() |
|
boolean |
isUpgradeSupported() |
|
org.xnio.StreamConnection |
performUpgrade() |
Upgrade the connection, if the underlying protocol supports it.
|
void |
sendRequest(ClientRequest request,
ClientCallback<ClientExchange> clientCallback) |
Sends a client request.
|
<T> T |
setOption(org.xnio.Option<T> option,
T value) |
|
boolean |
supportsOption(org.xnio.Option<?> option) |
void sendRequest(ClientRequest request, ClientCallback<ClientExchange> clientCallback)
Request objects can be queued. Once the request is in a state that it is ready to be sent the clientCallback
is invoked to provide the caller with the ClientExchange
If isMultiplexingSupported()
returns true then multiple requests may be active at the same time, and a later
request may complete before an earlier one.
Note that the request header may not be written out until after the callback has been invoked. This allows the client to write out a header with a gathering write if the request contains content.
request
- The request to send.org.xnio.StreamConnection performUpgrade() throws java.io.IOException
java.io.IOException
ByteBufferPool getBufferPool()
java.net.SocketAddress getPeerAddress()
<A extends java.net.SocketAddress> A getPeerAddress(java.lang.Class<A> type)
org.xnio.ChannelListener.Setter<? extends ClientConnection> getCloseSetter()
java.net.SocketAddress getLocalAddress()
<A extends java.net.SocketAddress> A getLocalAddress(java.lang.Class<A> type)
org.xnio.XnioWorker getWorker()
org.xnio.XnioIoThread getIoThread()
boolean isOpen()
isOpen
in interface java.nio.channels.Channel
boolean supportsOption(org.xnio.Option<?> option)
<T> T getOption(org.xnio.Option<T> option) throws java.io.IOException
java.io.IOException
<T> T setOption(org.xnio.Option<T> option, T value) throws java.lang.IllegalArgumentException, java.io.IOException
java.lang.IllegalArgumentException
java.io.IOException
boolean isUpgraded()
boolean isPushSupported()
true
if this connection support server pushboolean isMultiplexingSupported()
true
if this client supports multiplexingClientStatistics getStatistics()
null
if statistics are not supported or disabledboolean isUpgradeSupported()
void addCloseListener(org.xnio.ChannelListener<ClientConnection> listener)
listener
- The close listenerCopyright © 2018. All rights reserved.