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 TypeMethodDescriptionbooleanCheck whether this connection is allowed to send 100-Continue.voidallowExpectContinue(boolean allowExpectContinue) Set whether this connection allows 100-Continue to be sent.Channel id, mostly used in logs.voidCloses 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 TcpClientConnectioncreate(WebClient webClient, ConnectionKey connectionKey, List<String> tcpProtocolIds, Function<TcpClientConnection, Boolean> releaseFunction, Consumer<TcpClientConnection> closeConsumer) Create a new TCP Connection.AssociatedHelidonSocket.booleanreader()Data reader providing response bytes.voidreadTimeout(Duration readTimeout) Read timeout for this connection.voidReleases 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, iffalseis 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:ClientConnectionData reader providing response bytes.- Specified by:
readerin interfaceClientConnection- Returns:
- reader to read from this connection
-
writer
Description copied from interface:ClientConnectionData writer the client request writes to.- Specified by:
writerin interfaceClientConnection- Returns:
- writer to write to this connection
-
releaseResource
public void releaseResource()Description copied from interface:ReleasableResourceReleases the resource, and if this resource is re-usable, enabled reuse.- Specified by:
releaseResourcein interfaceReleasableResource
-
closeResource
public void closeResource()Description copied from interface:ReleasableResourceCloses the resource, we cannot use nameclose, as that would conflict withAutoCloseable, as we do not want to have a checked exception thrown.- Specified by:
closeResourcein interfaceReleasableResource
-
channelId
Description copied from interface:ClientConnectionChannel id, mostly used in logs.- Specified by:
channelIdin interfaceClientConnection- Returns:
- id of this channel (connection)
-
readTimeout
Description copied from interface:ClientConnectionRead timeout for this connection.- Specified by:
readTimeoutin interfaceClientConnection- Parameters:
readTimeout- connection read timeout
-
helidonSocket
Description copied from interface:ClientConnectionAssociatedHelidonSocket.- Specified by:
helidonSocketin interfaceClientConnection- Returns:
- socket of this connection
-
isConnected
public boolean isConnected() -
allowExpectContinue
public boolean allowExpectContinue()Description copied from interface:ClientConnectionCheck whether this connection is allowed to send 100-Continue.- Specified by:
allowExpectContinuein interfaceClientConnection- Returns:
- whether 100-Continue is allowed
-
allowExpectContinue
public void allowExpectContinue(boolean allowExpectContinue) Description copied from interface:ClientConnectionSet whether this connection allows 100-Continue to be sent.- Specified by:
allowExpectContinuein interfaceClientConnection- Parameters:
allowExpectContinue- whether to allow 100-Continue
-