java.lang.Object
io.helidon.webclient.api.TcpClientConnection
- All Implemented Interfaces:
ClientConnection
,ReleasableResource
A TCP connection that can be used by any protocol that is based on TCP.
The connection supports proxying and is not attempting to cache anything.
-
Method Summary
Modifier and TypeMethodDescriptionChannel id, mostly used in logs.void
Closes the resource, we cannot use nameclose
, as that would conflict withAutoCloseable
, as we do not want to have a checked exception thrown.connect()
Connect this connection over the network.static TcpClientConnection
create
(WebClient webClient, ConnectionKey connectionKey, List<String> tcpProtocolIds, Function<TcpClientConnection, Boolean> releaseFunction, Consumer<TcpClientConnection> closeConsumer) Create a new TCP Connection.AssociatedHelidonSocket
.boolean
reader()
Data reader providing response bytes.void
readTimeout
(Duration readTimeout) Read timeout for this connection.void
Releases the resource, and if this resource is re-usable, enabled reuse.writer()
Data writer the client request writes to.
-
Method Details
-
create
public static TcpClientConnection create(WebClient webClient, ConnectionKey connectionKey, List<String> tcpProtocolIds, Function<TcpClientConnection, Boolean> releaseFunction, Consumer<TcpClientConnection> closeConsumer) Create a new TCP Connection.- Parameters:
webClient
- webclient, may be used to create proxy connectionsconnectionKey
- connection key of the new connection (where and how to connect)tcpProtocolIds
- protocol IDs for ALPN (TLS protocol negotiation)releaseFunction
- called whenreleaseResource()
is called, iffalse
is returned, the connection will be closed instead kept opencloseConsumer
- called whencloseResource()
is called, the connection is no longer usable after this moment- Returns:
- a new TCP connection,
connect()
must be called to make it available for use
-
connect
Connect this connection over the network. This will resolve proxy connection, TLS negotiation (including ALPN) and return a connected connection.- Returns:
- this connection, connected to the remote socket
-
reader
Description copied from interface:ClientConnection
Data reader providing response bytes.- Specified by:
reader
in interfaceClientConnection
- Returns:
- reader to read from this connection
-
writer
Description copied from interface:ClientConnection
Data writer the client request writes to.- Specified by:
writer
in interfaceClientConnection
- Returns:
- writer to write to this connection
-
releaseResource
public void releaseResource()Description copied from interface:ReleasableResource
Releases the resource, and if this resource is re-usable, enabled reuse.- Specified by:
releaseResource
in interfaceReleasableResource
-
closeResource
public void closeResource()Description copied from interface:ReleasableResource
Closes the resource, we cannot use nameclose
, as that would conflict withAutoCloseable
, as we do not want to have a checked exception thrown.- Specified by:
closeResource
in interfaceReleasableResource
-
channelId
Description copied from interface:ClientConnection
Channel id, mostly used in logs.- Specified by:
channelId
in interfaceClientConnection
- Returns:
- id of this channel (connection)
-
readTimeout
Description copied from interface:ClientConnection
Read timeout for this connection.- Specified by:
readTimeout
in interfaceClientConnection
- Parameters:
readTimeout
- connection read timeout
-
helidonSocket
Description copied from interface:ClientConnection
AssociatedHelidonSocket
.- Specified by:
helidonSocket
in interfaceClientConnection
- Returns:
- socket of this connection
-
isConnected
public boolean isConnected()
-