ClientConnection
, java.io.Closeable
, java.lang.AutoCloseable
, java.nio.channels.Channel
public class Http2ClientConnection extends java.lang.Object implements ClientConnection
Constructor | Description |
---|---|
Http2ClientConnection(Http2Channel http2Channel,
boolean initialUpgradeRequest,
java.lang.String defaultHost,
ClientStatistics clientStatistics,
boolean secure) |
|
Http2ClientConnection(Http2Channel http2Channel,
ClientCallback<ClientExchange> upgradeReadyCallback,
ClientRequest clientRequest,
java.lang.String defaultHost,
ClientStatistics clientStatistics,
boolean secure) |
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
|
void |
close() |
|
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) |
public Http2ClientConnection(Http2Channel http2Channel, boolean initialUpgradeRequest, java.lang.String defaultHost, ClientStatistics clientStatistics, boolean secure)
public Http2ClientConnection(Http2Channel http2Channel, ClientCallback<ClientExchange> upgradeReadyCallback, ClientRequest clientRequest, java.lang.String defaultHost, ClientStatistics clientStatistics, boolean secure)
public void sendRequest(ClientRequest request, ClientCallback<ClientExchange> clientCallback)
ClientConnection
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 ClientConnection.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.
sendRequest
in interface ClientConnection
request
- The request to send.public org.xnio.StreamConnection performUpgrade() throws java.io.IOException
ClientConnection
performUpgrade
in interface ClientConnection
java.io.IOException
public ByteBufferPool getBufferPool()
getBufferPool
in interface ClientConnection
public java.net.SocketAddress getPeerAddress()
getPeerAddress
in interface ClientConnection
public <A extends java.net.SocketAddress> A getPeerAddress(java.lang.Class<A> type)
getPeerAddress
in interface ClientConnection
public org.xnio.ChannelListener.Setter<? extends ClientConnection> getCloseSetter()
getCloseSetter
in interface ClientConnection
public java.net.SocketAddress getLocalAddress()
getLocalAddress
in interface ClientConnection
public <A extends java.net.SocketAddress> A getLocalAddress(java.lang.Class<A> type)
getLocalAddress
in interface ClientConnection
public org.xnio.XnioWorker getWorker()
getWorker
in interface ClientConnection
public org.xnio.XnioIoThread getIoThread()
getIoThread
in interface ClientConnection
public boolean isOpen()
isOpen
in interface java.nio.channels.Channel
isOpen
in interface ClientConnection
public void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
close
in interface java.nio.channels.Channel
close
in interface java.io.Closeable
java.io.IOException
public boolean supportsOption(org.xnio.Option<?> option)
supportsOption
in interface ClientConnection
public <T> T getOption(org.xnio.Option<T> option) throws java.io.IOException
getOption
in interface ClientConnection
java.io.IOException
public <T> T setOption(org.xnio.Option<T> option, T value) throws java.lang.IllegalArgumentException, java.io.IOException
setOption
in interface ClientConnection
java.lang.IllegalArgumentException
java.io.IOException
public boolean isUpgraded()
isUpgraded
in interface ClientConnection
public boolean isPushSupported()
isPushSupported
in interface ClientConnection
true
if this connection support server pushpublic boolean isMultiplexingSupported()
isMultiplexingSupported
in interface ClientConnection
true
if this client supports multiplexingpublic ClientStatistics getStatistics()
getStatistics
in interface ClientConnection
null
if statistics are not supported or disabledpublic boolean isUpgradeSupported()
isUpgradeSupported
in interface ClientConnection
public void addCloseListener(org.xnio.ChannelListener<ClientConnection> listener)
ClientConnection
addCloseListener
in interface ClientConnection
listener
- The close listenerCopyright © 2018. All rights reserved.