Class NetClient
- java.lang.Object
-
- io.vertx.reactivex.core.net.NetClient
-
- All Implemented Interfaces:
RxDelegate,Measured
public class NetClient extends Object implements RxDelegate, Measured
A TCP client.Multiple connections to different servers can be made using the same instance.
This client supports a configurable number of connection attempts and a configurable delay between attempts.
NOTE: This class has been automatically generated from the
originalnon RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<NetClient>__TYPE_ARG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Future<Void>close()Close immediately (shutdown(0, TimeUnit.SECONDS).Future<NetSocket>connect(int port, String host)Open a connection to a server at the specificportandhost.Future<NetSocket>connect(int port, String host, String serverName)Open a connection to a server at the specificportandhost.Future<NetSocket>connect(ConnectOptions connectOptions)Open a connection to a server at the specificconnectOptions.Future<NetSocket>connect(SocketAddress remoteAddress)Open a connection to a server at the specificremoteAddress.Future<NetSocket>connect(SocketAddress remoteAddress, String serverName)Open a connection to a server at the specificremoteAddress.booleanequals(Object o)NetClientgetDelegate()inthashCode()booleanisMetricsEnabled()Whether the metrics are enabled for this measured objectstatic NetClientnewInstance(NetClient arg)io.reactivex.CompletablerxClose()Close immediately (shutdown(0, TimeUnit.SECONDS).io.reactivex.Single<NetSocket>rxConnect(int port, String host)Open a connection to a server at the specificportandhost.io.reactivex.Single<NetSocket>rxConnect(int port, String host, String serverName)Open a connection to a server at the specificportandhost.io.reactivex.Single<NetSocket>rxConnect(ConnectOptions connectOptions)Open a connection to a server at the specificconnectOptions.io.reactivex.Single<NetSocket>rxConnect(SocketAddress remoteAddress)Open a connection to a server at the specificremoteAddress.io.reactivex.Single<NetSocket>rxConnect(SocketAddress remoteAddress, String serverName)Open a connection to a server at the specificremoteAddress.io.reactivex.CompletablerxShutdown()Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).io.reactivex.CompletablerxShutdown(long timeout, TimeUnit unit)Initiate the client shutdown sequence.io.reactivex.Single<Boolean>rxUpdateSSLOptions(ClientSSLOptions options)Update the client with new SSLoptions, the update happens if the options object is valid and different from the existing options object.io.reactivex.Single<Boolean>rxUpdateSSLOptions(ClientSSLOptions options, boolean force)Update the client with new SSLoptions, the update happens if the options object is valid and different from the existing options object.Future<Void>shutdown()Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).Future<Void>shutdown(long timeout, TimeUnit unit)Initiate the client shutdown sequence.StringtoString()Future<Boolean>updateSSLOptions(ClientSSLOptions options)Update the client with new SSLoptions, the update happens if the options object is valid and different from the existing options object.Future<Boolean>updateSSLOptions(ClientSSLOptions options, boolean force)Update the client with new SSLoptions, the update happens if the options object is valid and different from the existing options object.
-
-
-
Method Detail
-
getDelegate
public NetClient getDelegate()
- Specified by:
getDelegatein interfaceMeasured- Specified by:
getDelegatein interfaceRxDelegate
-
isMetricsEnabled
public boolean isMetricsEnabled()
Whether the metrics are enabled for this measured object- Specified by:
isMetricsEnabledin interfaceMeasured- Returns:
trueif metrics are enabled
-
connect
public Future<NetSocket> connect(int port, String host)
Open a connection to a server at the specificportandhost.hostcan be a valid host name or IP address. The connect is done asynchronously and on success, aNetSocketinstance is supplied via theconnectHandlerinstance- Parameters:
port- the porthost- the host- Returns:
- a future notified when the socket is connected
-
rxConnect
public io.reactivex.Single<NetSocket> rxConnect(int port, String host)
Open a connection to a server at the specificportandhost.hostcan be a valid host name or IP address. The connect is done asynchronously and on success, aNetSocketinstance is supplied via theconnectHandlerinstance- Parameters:
port- the porthost- the host- Returns:
- a future notified when the socket is connected
-
connect
public Future<NetSocket> connect(int port, String host, String serverName)
Open a connection to a server at the specificportandhost.hostcan be a valid host name or IP address. The connect is done asynchronously and on success, aNetSocketinstance is supplied via theconnectHandlerinstance- Parameters:
port- the porthost- the hostserverName- the SNI server name- Returns:
- a future notified when the socket is connected
-
rxConnect
public io.reactivex.Single<NetSocket> rxConnect(int port, String host, String serverName)
Open a connection to a server at the specificportandhost.hostcan be a valid host name or IP address. The connect is done asynchronously and on success, aNetSocketinstance is supplied via theconnectHandlerinstance- Parameters:
port- the porthost- the hostserverName- the SNI server name- Returns:
- a future notified when the socket is connected
-
connect
public Future<NetSocket> connect(SocketAddress remoteAddress)
Open a connection to a server at the specificremoteAddress.The connect is done asynchronously and on success, a
NetSocketinstance is supplied via theconnectHandlerinstance- Parameters:
remoteAddress- the remote address- Returns:
- a future notified when the socket is connected
-
rxConnect
public io.reactivex.Single<NetSocket> rxConnect(SocketAddress remoteAddress)
Open a connection to a server at the specificremoteAddress.The connect is done asynchronously and on success, a
NetSocketinstance is supplied via theconnectHandlerinstance- Parameters:
remoteAddress- the remote address- Returns:
- a future notified when the socket is connected
-
connect
public Future<NetSocket> connect(SocketAddress remoteAddress, String serverName)
Open a connection to a server at the specificremoteAddress.The connect is done asynchronously and on success, a
NetSocketinstance is supplied via theconnectHandlerinstance- Parameters:
remoteAddress- the remote addressserverName- the SNI server name- Returns:
- a future notified when the socket is connected
-
rxConnect
public io.reactivex.Single<NetSocket> rxConnect(SocketAddress remoteAddress, String serverName)
Open a connection to a server at the specificremoteAddress.The connect is done asynchronously and on success, a
NetSocketinstance is supplied via theconnectHandlerinstance- Parameters:
remoteAddress- the remote addressserverName- the SNI server name- Returns:
- a future notified when the socket is connected
-
connect
public Future<NetSocket> connect(ConnectOptions connectOptions)
Open a connection to a server at the specificconnectOptions.The connect is done asynchronously and on success, a
NetSocketinstance is supplied via theconnectHandlerinstance- Parameters:
connectOptions- the options describing how to connect to the remote server- Returns:
- a future notified when the socket is connected
-
rxConnect
public io.reactivex.Single<NetSocket> rxConnect(ConnectOptions connectOptions)
Open a connection to a server at the specificconnectOptions.The connect is done asynchronously and on success, a
NetSocketinstance is supplied via theconnectHandlerinstance- Parameters:
connectOptions- the options describing how to connect to the remote server- Returns:
- a future notified when the socket is connected
-
close
public Future<Void> close()
Close immediately (shutdown(0, TimeUnit.SECONDS).- Returns:
- a future notified when the client is closed
-
rxClose
public io.reactivex.Completable rxClose()
Close immediately (shutdown(0, TimeUnit.SECONDS).- Returns:
- a future notified when the client is closed
-
shutdown
public Future<Void> shutdown()
Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).- Returns:
- a future completed when shutdown has completed
-
rxShutdown
public io.reactivex.Completable rxShutdown()
Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).- Returns:
- a future completed when shutdown has completed
-
shutdown
public Future<Void> shutdown(long timeout, TimeUnit unit)
Initiate the client shutdown sequence.Connections are taken out of service and notified the close sequence has started through
NetSocket.shutdownHandler(io.vertx.core.Handler<java.lang.Void>). When all connections are closed the client is closed. When thetimeoutexpires, all unclosed connections are immediately closed.- Parameters:
timeout- the amount of time after which all resources are forcibly closedunit- the of the timeout- Returns:
- a future notified when the client is closed
-
rxShutdown
public io.reactivex.Completable rxShutdown(long timeout, TimeUnit unit)Initiate the client shutdown sequence.Connections are taken out of service and notified the close sequence has started through
NetSocket.shutdownHandler(io.vertx.core.Handler<java.lang.Void>). When all connections are closed the client is closed. When thetimeoutexpires, all unclosed connections are immediately closed.- Parameters:
timeout- the amount of time after which all resources are forcibly closedunit- the of the timeout- Returns:
- a future notified when the client is closed
-
updateSSLOptions
public Future<Boolean> updateSSLOptions(ClientSSLOptions options)
Update the client with new SSL
options, the update happens if the options object is valid and different from the existing options object.The boolean succeeded future result indicates whether the update occurred.
- Parameters:
options- the new SSL options- Returns:
- a future signaling the update success
-
rxUpdateSSLOptions
public io.reactivex.Single<Boolean> rxUpdateSSLOptions(ClientSSLOptions options)
Update the client with new SSL
options, the update happens if the options object is valid and different from the existing options object.The boolean succeeded future result indicates whether the update occurred.
- Parameters:
options- the new SSL options- Returns:
- a future signaling the update success
-
updateSSLOptions
public Future<Boolean> updateSSLOptions(ClientSSLOptions options, boolean force)
Update the client with new SSL
options, the update happens if the options object is valid and different from the existing options object.The
optionsobject is compared using itsequalsmethod against the existing options to prevent an update when the objects are equals since loading options can be costly, this can happen for share TCP servers. When object are equals, settingforcetotrueforces the update.The boolean succeeded future result indicates whether the update occurred.
- Parameters:
options- the new SSL optionsforce- force the update when options are equals- Returns:
- a future signaling the update success
-
rxUpdateSSLOptions
public io.reactivex.Single<Boolean> rxUpdateSSLOptions(ClientSSLOptions options, boolean force)
Update the client with new SSL
options, the update happens if the options object is valid and different from the existing options object.The
optionsobject is compared using itsequalsmethod against the existing options to prevent an update when the objects are equals since loading options can be costly, this can happen for share TCP servers. When object are equals, settingforcetotrueforces the update.The boolean succeeded future result indicates whether the update occurred.
- Parameters:
options- the new SSL optionsforce- force the update when options are equals- Returns:
- a future signaling the update success
-
-