|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.paho.client.mqttv3.MqttConnectOptions
public class MqttConnectOptions
Holds options that control how the client connects to a server.
Field Summary | |
---|---|
static boolean |
CLEAN_SESSION_DEFAULT
The default clean session setting if one is not specified |
static int |
CONNECTION_TIMEOUT_DEFAULT
The default connection timeout in seconds if one is not specified |
static int |
KEEP_ALIVE_INTERVAL_DEFAULT
The default keep alive interval in seconds if one is not specified |
Constructor Summary | |
---|---|
MqttConnectOptions()
Constructs a new MqttConnectOptions object using the
default values. |
Method Summary | |
---|---|
int |
getConnectionTimeout()
Returns the connection timeout value. |
java.util.Properties |
getDebug()
|
int |
getKeepAliveInterval()
Returns the "keep alive" interval. |
char[] |
getPassword()
Returns the password to use for the connection. |
javax.net.SocketFactory |
getSocketFactory()
Returns the socket factory that will be used when connecting, or null if one has not been set. |
java.util.Properties |
getSSLProperties()
Returns the SSL properties for the connection. |
java.lang.String |
getUserName()
Returns the user name to use for the connection. |
java.lang.String |
getWillDestination()
Returns the topic to be used for last will and testament (LWT). |
MqttMessage |
getWillMessage()
Returns the message to be sent as last will and testament (LWT). |
boolean |
isCleanSession()
Returns whether the server should remember state for the client across reconnects. |
void |
setCleanSession(boolean cleanSession)
Sets whether the server should remember state for the client across reconnects. |
void |
setConnectionTimeout(int connectionTimeout)
Sets the connection timeout value. |
void |
setKeepAliveInterval(int keepAliveInterval)
Sets the "keep alive" interval. |
void |
setPassword(char[] password)
Sets the password to use for the connection. |
void |
setSocketFactory(javax.net.SocketFactory socketFactory)
Sets the SocketFactory to use. |
void |
setSSLProperties(java.util.Properties props)
Sets the SSL properties for the connection. |
void |
setUserName(java.lang.String userName)
Sets the user name to use for the connection. |
void |
setWill(MqttTopic topic,
byte[] payload,
int qos,
boolean retained)
Sets the "Last Will and Testament" (LWT) for the connection. |
void |
setWill(java.lang.String topic,
byte[] payload,
int qos,
boolean retained)
Sets the "Last Will and Testament" (LWT) for the connection. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int KEEP_ALIVE_INTERVAL_DEFAULT
public static final int CONNECTION_TIMEOUT_DEFAULT
public static final boolean CLEAN_SESSION_DEFAULT
Constructor Detail |
---|
public MqttConnectOptions()
MqttConnectOptions
object using the
default values.
The defaults are:
Method Detail |
---|
public char[] getPassword()
public void setPassword(char[] password)
public java.lang.String getUserName()
public void setUserName(java.lang.String userName)
java.lang.IllegalArgumentException
- if the user name is blank or only
contains whitespace characters.public void setWill(MqttTopic topic, byte[] payload, int qos, boolean retained)
topic
- the topic to publish to.payload
- the byte payload for the message.qos
- the quality of service to publish the message at (0, 1 or 2).retained
- whether or not the message should be retained.public void setWill(java.lang.String topic, byte[] payload, int qos, boolean retained)
topic
- the topic to publish to.payload
- the byte payload for the message.qos
- the quality of service to publish the message at (0, 1 or 2).retained
- whether or not the message should be retained.public int getKeepAliveInterval()
setKeepAliveInterval(int)
public void setKeepAliveInterval(int keepAliveInterval) throws java.lang.IllegalArgumentException
The default value is 60 seconds
keepAliveInterval
- the interval, measured in seconds, must be >= 0.
java.lang.IllegalArgumentException
public int getConnectionTimeout()
setConnectionTimeout(int)
public void setConnectionTimeout(int connectionTimeout)
connectionTimeout
- the timeout value, measured in seconds.public javax.net.SocketFactory getSocketFactory()
null
if one has not been set.
public void setSocketFactory(javax.net.SocketFactory socketFactory)
SocketFactory
to use. This allows an application
to apply its own policies around the creation of network sockets. If
using an SSL connection, an SSLSocketFactory
can be used
to supply application-specific security settings.
socketFactory
- the factory to use.public java.lang.String getWillDestination()
null
if LWT is not set.setWill(MqttTopic, byte[], int, boolean)
public MqttMessage getWillMessage()
IllegalStateException
being thrown.
null
if LWT is not set.public java.util.Properties getSSLProperties()
public void setSSLProperties(java.util.Properties props)
setSocketFactory(SocketFactory)
.
The following properties can be used:
com.ibm.micro.security.Password.obfuscate(char[] password)
.
This obfuscates the password using a simple and insecure XOR and Base64
encoding mechanism. Note that this is only a simple scrambler to
obfuscate clear-text passwords.com.ibm.micro.security.Password.obfuscate(char[] password)
.
This obfuscates the password using a simple and insecure XOR and Base64
encoding mechanism. Note that this is only a simple scrambler to
obfuscate clear-text passwords.
public boolean isCleanSession()
public void setCleanSession(boolean cleanSession)
public java.util.Properties getDebug()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |