|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vertx.groovy.core.net.NetClient
abstract class NetClient
A TCP/SSL 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.
If an instance is instantiated from an event loop then the handlers of the instance will always be called on that same event loop. If an instance is instantiated from some other arbitrary Java thread then an event loop will be assigned to the instance and used when any of its handlers are called.
Instances cannot be used from worker verticles
Field Summary | |
---|---|
protected NetClient |
jClient
|
Method Summary | |
---|---|
void
|
close()
Close the client. |
NetClient
|
connect(int port, java.lang.Object hndlr)
Attempt to open a connection to a server at the specific port and host localhost The connect is done asynchronously and on success, a NetSocket instance is supplied via the connectHandler instance |
NetClient
|
connect(int port, java.lang.String host, groovy.lang.Closure hndlr)
Attempt to open a connection to a server at the specific port and host. |
java.lang.Integer
|
getBossThreads()
@return The number of boss threads |
java.lang.Long
|
getConnectTimeout()
@return The connect timeout |
java.lang.String
|
getKeyStorePassword()
@return The keystore password |
java.lang.String
|
getKeyStorePath()
@return The path to the key store |
java.lang.Integer
|
getReceiveBufferSize()
@return The TCP receive buffer size |
int
|
getReconnectAttempts()
Get the number of reconnect attempts |
long
|
getReconnectInterval()
Get the reconnect interval, in milliseconds. |
java.lang.Integer
|
getSendBufferSize()
@return The TCP send buffer size |
java.lang.Integer
|
getTrafficClass()
@return the value of TCP traffic class |
java.lang.String
|
getTrustStorePassword()
@return The trust store password |
java.lang.String
|
getTrustStorePath()
@return The trust store path |
java.lang.Boolean
|
isReuseAddress()
@return The value of TCP reuse address |
boolean
|
isSSL()
@return true if this client will make SSL connections |
java.lang.Boolean
|
isSoLinger()
@return the value of TCP so linger |
java.lang.Boolean
|
isTCPKeepAlive()
@return true if TCP keep alive is enabled |
java.lang.Boolean
|
isTCPNoDelay()
@return true if Nagle's algorithm is disabled. |
NetClient
|
setBossThreads(long threads)
Set the number of boss threads to use. |
NetClient
|
setConnectTimeout(long timeout)
Set the connect timeout in milliseconds |
NetClient
|
setKeyStorePassword(java.lang.String pwd)
Set the password for the SSL key store. |
NetClient
|
setKeyStorePath(java.lang.String path)
Set the path to the SSL key store. |
NetClient
|
setReceiveBufferSize(int size)
Set the TCP receive buffer size for connections created by this instance to size in bytes. |
NetClient
|
setReconnectAttempts(int attempts)
Set the number of reconnection attempts. |
NetClient
|
setReconnectInterval(long interval)
Set the reconnect interval, in milliseconds |
NetClient
|
setReuseAddress(boolean reuse)
Set the TCP reuseAddress setting for connections created by this instance to reuse. |
NetClient
|
setSSL(boolean ssl)
If ssl is true, this signifies that any connections will be SSL connections. |
NetClient
|
setSendBufferSize(int size)
Set the TCP send buffer size for connections created by this instance to size in bytes. |
NetClient
|
setSoLinger(boolean linger)
Set the TCP soLinger setting for connections created by this instance to linger. |
NetClient
|
setTCPKeepAlive(boolean keepAlive)
Set the TCP keepAlive setting for connections created by this instance to keepAlive. |
NetClient
|
setTCPNoDelay(boolean tcpNoDelay)
If tcpNoDelay is set to true then Nagle's algorithm will turned off for the TCP connections created by this instance. |
NetClient
|
setTrafficClass(int trafficClass)
Set the TCP trafficClass setting for connections created by this instance to trafficClass. |
NetClient
|
setTrustAll(boolean trustAll)
If you want an SSL client to trust *all* server certificates rather than match them against those in its trust store, you can set this to true. |
NetClient
|
setTrustStorePassword(java.lang.String pwd)
Set the password for the SSL trust store. |
NetClient
|
setTrustStorePath(java.lang.String path)
Set the path to the SSL trust store. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
protected NetClient jClient
Method Detail |
---|
void close()
NetClient connect(int port, java.lang.Object hndlr)
NetClient connect(int port, java.lang.String host, groovy.lang.Closure hndlr)
java.lang.Integer getBossThreads()
java.lang.Long getConnectTimeout()
java.lang.String getKeyStorePassword()
java.lang.String getKeyStorePath()
java.lang.Integer getReceiveBufferSize()
int getReconnectAttempts()
long getReconnectInterval()
java.lang.Integer getSendBufferSize()
java.lang.Integer getTrafficClass()
java.lang.String getTrustStorePassword()
java.lang.String getTrustStorePath()
java.lang.Boolean isReuseAddress()
boolean isSSL()
java.lang.Boolean isSoLinger()
java.lang.Boolean isTCPKeepAlive()
java.lang.Boolean isTCPNoDelay()
NetClient setBossThreads(long threads)
NetClient setConnectTimeout(long timeout)
NetClient setKeyStorePassword(java.lang.String pwd)
NetClient setKeyStorePath(java.lang.String path)
The SSL key store is a standard Java Key Store, and will contain the client certificate. Client certificates are only required if the server requests client authentication.
NetClient setReceiveBufferSize(int size)
NetClient setReconnectAttempts(int attempts)
NetClient setReconnectInterval(long interval)
NetClient setReuseAddress(boolean reuse)
NetClient setSSL(boolean ssl)
NetClient setSendBufferSize(int size)
NetClient setSoLinger(boolean linger)
NetClient setTCPKeepAlive(boolean keepAlive)
NetClient setTCPNoDelay(boolean tcpNoDelay)
NetClient setTrafficClass(int trafficClass)
NetClient setTrustAll(boolean trustAll)
Use this with caution as you may be exposed to "main in the middle" attacks
trustAll
- Set to true if you want to trust all server certificates
NetClient setTrustStorePassword(java.lang.String pwd)
NetClient setTrustStorePath(java.lang.String path)
The trust store is a standard Java Key Store, and should contain the certificates of any servers that the client trusts. If you wish the client to trust all server certificates you can use the setTrustAll(boolean) method.
Groovy Documentation