Class NetClient
- java.lang.Object
-
- io.vertx.mutiny.core.net.NetClient
-
- All Implemented Interfaces:
Measured
public class NetClient extends Object implements 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 theoriginal
non Mutiny-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 io.smallrye.mutiny.Uni<Void>
close()
Close the client.Void
closeAndAwait()
Blocking variant ofclose()
.void
closeAndForget()
Variant ofclose()
that ignores the result of the operation.io.smallrye.mutiny.Uni<NetSocket>
connect(int port, String host)
Open a connection to a server at the specificport
andhost
.io.smallrye.mutiny.Uni<NetSocket>
connect(int port, String host, String serverName)
Open a connection to a server at the specificport
andhost
.io.smallrye.mutiny.Uni<NetSocket>
connect(SocketAddress remoteAddress)
Open a connection to a server at the specificremoteAddress
.io.smallrye.mutiny.Uni<NetSocket>
connect(SocketAddress remoteAddress, String serverName)
Open a connection to a server at the specificremoteAddress
.NetSocket
connectAndAwait(int port, String host)
Blocking variant ofconnect(int,String)
.NetSocket
connectAndAwait(int port, String host, String serverName)
Blocking variant ofconnect(int,String,String)
.NetSocket
connectAndAwait(SocketAddress remoteAddress)
Blocking variant ofconnect(io.vertx.mutiny.core.net.SocketAddress)
.NetSocket
connectAndAwait(SocketAddress remoteAddress, String serverName)
Blocking variant ofconnect(io.vertx.mutiny.core.net.SocketAddress,String)
.NetClient
connectAndForget(int port, String host)
Variant ofconnect(int,String)
that ignores the result of the operation.NetClient
connectAndForget(int port, String host, String serverName)
Variant ofconnect(int,String,String)
that ignores the result of the operation.NetClient
connectAndForget(SocketAddress remoteAddress)
Variant ofconnect(io.vertx.mutiny.core.net.SocketAddress)
that ignores the result of the operation.NetClient
connectAndForget(SocketAddress remoteAddress, String serverName)
Variant ofconnect(io.vertx.mutiny.core.net.SocketAddress,String)
that ignores the result of the operation.boolean
equals(Object o)
io.vertx.core.net.NetClient
getDelegate()
int
hashCode()
boolean
isMetricsEnabled()
static NetClient
newInstance(io.vertx.core.net.NetClient arg)
String
toString()
io.smallrye.mutiny.Uni<Boolean>
updateSSLOptions(io.vertx.core.net.SSLOptions options)
LikeupdateSSLOptions(io.vertx.core.net.SSLOptions)
but supplying a handler that will be called when the update happened (or has failed).io.smallrye.mutiny.Uni<Boolean>
updateSSLOptions(io.vertx.core.net.SSLOptions options, boolean force)
LikeupdateSSLOptions(io.vertx.core.net.SSLOptions)
but supplying a handler that will be called when the update happened (or has failed).Boolean
updateSSLOptionsAndAwait(io.vertx.core.net.SSLOptions options)
Blocking variant ofupdateSSLOptions(SSLOptions)
.Boolean
updateSSLOptionsAndAwait(io.vertx.core.net.SSLOptions options, boolean force)
Blocking variant ofupdateSSLOptions(SSLOptions,boolean)
.void
updateSSLOptionsAndForget(io.vertx.core.net.SSLOptions options)
Variant ofupdateSSLOptions(SSLOptions)
that ignores the result of the operation.void
updateSSLOptionsAndForget(io.vertx.core.net.SSLOptions options, boolean force)
Variant ofupdateSSLOptions(SSLOptions,boolean)
that ignores the result of the operation.
-
-
-
Constructor Detail
-
NetClient
public NetClient(io.vertx.core.net.NetClient delegate)
-
NetClient
public NetClient(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.core.net.NetClient getDelegate()
- Specified by:
getDelegate
in interfaceMeasured
-
isMetricsEnabled
public boolean isMetricsEnabled()
- Specified by:
isMetricsEnabled
in interfaceMeasured
- Returns:
true
if metrics are enabled
-
connect
@CheckReturnValue public io.smallrye.mutiny.Uni<NetSocket> connect(int port, String host)
Open a connection to a server at the specificport
andhost
.host
can be a valid host name or IP address. The connect is done asynchronously and on success, aNetSocket
instance is supplied via theconnectHandler
instanceUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
port
- the porthost
- the host- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
public NetSocket connectAndAwait(int port, String host)
Blocking variant ofconnect(int,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
port
- the porthost
- the host- Returns:
- the NetSocket instance produced by the operation.
-
connectAndForget
public NetClient connectAndForget(int port, String host)
Variant ofconnect(int,String)
that ignores the result of the operation.This method subscribes on the result of
connect(int,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(int,String)
but you don't need to compose it with other operations.- Parameters:
port
- the porthost
- the host- Returns:
- the instance of NetClient to chain method calls.
-
connect
@CheckReturnValue public io.smallrye.mutiny.Uni<NetSocket> connect(int port, String host, String serverName)
Open a connection to a server at the specificport
andhost
.host
can be a valid host name or IP address. The connect is done asynchronously and on success, aNetSocket
instance is supplied via theconnectHandler
instanceUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
port
- the porthost
- the hostserverName
- the SNI server name- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
public NetSocket connectAndAwait(int port, String host, String serverName)
Blocking variant ofconnect(int,String,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
port
- the porthost
- the hostserverName
- the SNI server name- Returns:
- the NetSocket instance produced by the operation.
-
connectAndForget
public NetClient connectAndForget(int port, String host, String serverName)
Variant ofconnect(int,String,String)
that ignores the result of the operation.This method subscribes on the result of
connect(int,String,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(int,String,String)
but you don't need to compose it with other operations.- Parameters:
port
- the porthost
- the hostserverName
- the SNI server name- Returns:
- the instance of NetClient to chain method calls.
-
connect
@CheckReturnValue public io.smallrye.mutiny.Uni<NetSocket> connect(SocketAddress remoteAddress)
Open a connection to a server at the specificremoteAddress
.The connect is done asynchronously and on success, a
NetSocket
instance is supplied via theconnectHandler
instanceUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
remoteAddress
- the remote address- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
public NetSocket connectAndAwait(SocketAddress remoteAddress)
Blocking variant ofconnect(io.vertx.mutiny.core.net.SocketAddress)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
remoteAddress
- the remote address- Returns:
- the NetSocket instance produced by the operation.
-
connectAndForget
public NetClient connectAndForget(SocketAddress remoteAddress)
Variant ofconnect(io.vertx.mutiny.core.net.SocketAddress)
that ignores the result of the operation.This method subscribes on the result of
connect(io.vertx.mutiny.core.net.SocketAddress)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(io.vertx.mutiny.core.net.SocketAddress)
but you don't need to compose it with other operations.- Parameters:
remoteAddress
- the remote address- Returns:
- the instance of NetClient to chain method calls.
-
connect
@CheckReturnValue public io.smallrye.mutiny.Uni<NetSocket> connect(SocketAddress remoteAddress, String serverName)
Open a connection to a server at the specificremoteAddress
.The connect is done asynchronously and on success, a
NetSocket
instance is supplied via theconnectHandler
instanceUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
remoteAddress
- the remote addressserverName
- the SNI server name- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
public NetSocket connectAndAwait(SocketAddress remoteAddress, String serverName)
Blocking variant ofconnect(io.vertx.mutiny.core.net.SocketAddress,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
remoteAddress
- the remote addressserverName
- the SNI server name- Returns:
- the NetSocket instance produced by the operation.
-
connectAndForget
public NetClient connectAndForget(SocketAddress remoteAddress, String serverName)
Variant ofconnect(io.vertx.mutiny.core.net.SocketAddress,String)
that ignores the result of the operation.This method subscribes on the result of
connect(io.vertx.mutiny.core.net.SocketAddress,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(io.vertx.mutiny.core.net.SocketAddress,String)
but you don't need to compose it with other operations.- Parameters:
remoteAddress
- the remote addressserverName
- the SNI server name- Returns:
- the instance of NetClient to chain method calls.
-
close
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
Close the client.Any sockets which have not been closed manually will be closed here. The close is asynchronous and may not complete until some time after the method has returned.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
public Void closeAndAwait()
Blocking variant ofclose()
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
closeAndForget
public void closeAndForget()
-
updateSSLOptions
@CheckReturnValue public io.smallrye.mutiny.Uni<Boolean> updateSSLOptions(io.vertx.core.net.SSLOptions options)
LikeupdateSSLOptions(io.vertx.core.net.SSLOptions)
but supplying a handler that will be called when the update happened (or has failed).Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
options
- the new SSL options- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
updateSSLOptionsAndAwait
public Boolean updateSSLOptionsAndAwait(io.vertx.core.net.SSLOptions options)
Blocking variant ofupdateSSLOptions(SSLOptions)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
options
- the new SSL options- Returns:
- the Boolean instance produced by the operation.
-
updateSSLOptionsAndForget
public void updateSSLOptionsAndForget(io.vertx.core.net.SSLOptions options)
Variant ofupdateSSLOptions(SSLOptions)
that ignores the result of the operation.This method subscribes on the result of
updateSSLOptions(SSLOptions)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromupdateSSLOptions(SSLOptions)
but you don't need to compose it with other operations.- Parameters:
options
- the new SSL options
-
updateSSLOptions
@CheckReturnValue public io.smallrye.mutiny.Uni<Boolean> updateSSLOptions(io.vertx.core.net.SSLOptions options, boolean force)
LikeupdateSSLOptions(io.vertx.core.net.SSLOptions)
but supplying a handler that will be called when the update happened (or has failed).Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
options
- the new SSL optionsforce
- force the update when options are equals- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
updateSSLOptionsAndAwait
public Boolean updateSSLOptionsAndAwait(io.vertx.core.net.SSLOptions options, boolean force)
Blocking variant ofupdateSSLOptions(SSLOptions,boolean)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
options
- the new SSL optionsforce
- force the update when options are equals- Returns:
- the Boolean instance produced by the operation.
-
updateSSLOptionsAndForget
public void updateSSLOptionsAndForget(io.vertx.core.net.SSLOptions options, boolean force)
Variant ofupdateSSLOptions(SSLOptions,boolean)
that ignores the result of the operation.This method subscribes on the result of
updateSSLOptions(SSLOptions,boolean)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromupdateSSLOptions(SSLOptions,boolean)
but you don't need to compose it with other operations.- Parameters:
options
- the new SSL optionsforce
- force the update when options are equals
-
newInstance
public static NetClient newInstance(io.vertx.core.net.NetClient arg)
-
-