public class Http2ClientConnection extends Object implements ClientConnection
ClientConnection.PingListener
Constructor and Description |
---|
Http2ClientConnection(Http2Channel http2Channel, boolean initialUpgradeRequest, String defaultHost, ClientStatistics clientStatistics, boolean secure) |
Http2ClientConnection(Http2Channel http2Channel, ClientCallback<ClientExchange> upgradeReadyCallback, ClientRequest clientRequest, String defaultHost, ClientStatistics clientStatistics, boolean secure) |
Modifier and Type | Method and 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() |
SocketAddress | getLocalAddress() |
<A extends SocketAddress> | getLocalAddress(Class<A> type) |
<T> T | getOption(org.xnio.Option<T> option) |
SocketAddress | getPeerAddress() |
<A extends SocketAddress> | getPeerAddress(Class<A> type) |
ClientStatistics | getStatistics() |
org.xnio.XnioWorker | getWorker() |
boolean | isMultiplexingSupported() |
boolean | isOpen() |
boolean | isPingSupported() |
boolean | isPushSupported() |
boolean | isUpgraded() |
boolean | isUpgradeSupported() |
org.xnio.StreamConnection | performUpgrade() Upgrade the connection, if the underlying protocol supports it. |
void | sendPing(ClientConnection.PingListener listener, long timeout, TimeUnit timeUnit) |
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, String defaultHost, ClientStatistics clientStatistics, boolean secure)
public Http2ClientConnection(Http2Channel http2Channel, ClientCallback<ClientExchange> upgradeReadyCallback, ClientRequest clientRequest, 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 IOException
ClientConnection
performUpgrade
in interface ClientConnection
IOException
public ByteBufferPool getBufferPool()
getBufferPool
in interface ClientConnection
public SocketAddress getPeerAddress()
getPeerAddress
in interface ClientConnection
public <A extends SocketAddress> A getPeerAddress(Class<A> type)
getPeerAddress
in interface ClientConnection
public org.xnio.ChannelListener.Setter<? extends ClientConnection> getCloseSetter()
getCloseSetter
in interface ClientConnection
public SocketAddress getLocalAddress()
getLocalAddress
in interface ClientConnection
public <A extends SocketAddress> A getLocalAddress(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 ClientConnection
isOpen
in interface Channel
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
IOException
public boolean supportsOption(org.xnio.Option<?> option)
supportsOption
in interface ClientConnection
public <T> T getOption(org.xnio.Option<T> option) throws IOException
getOption
in interface ClientConnection
IOException
public <T> T setOption(org.xnio.Option<T> option, T value) throws IllegalArgumentException, IOException
setOption
in interface ClientConnection
IllegalArgumentException
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 listenerpublic boolean isPingSupported()
isPingSupported
in interface ClientConnection
true
if the underlying protocol supports sending a pingpublic void sendPing(ClientConnection.PingListener listener, long timeout, TimeUnit timeUnit)
sendPing
in interface ClientConnection
Copyright © 2020 JBoss by Red Hat. All rights reserved.