public class ConnectionConfiguration extends Object implements Cloneable
It is also possible to configure if TLS, SASL, and compression are used or not.
| Modifier and Type | Class and Description |
|---|---|
static class |
ConnectionConfiguration.SecurityMode
An enumeration for TLS security modes that are available when making a
connection to the XMPP server.
|
| Modifier and Type | Field and Description |
|---|---|
protected List<HostAddress> |
hostAddresses |
protected ProxyInfo |
proxy |
| Constructor and Description |
|---|
ConnectionConfiguration(String serviceName)
Creates a new ConnectionConfiguration for the specified service name.
|
ConnectionConfiguration(String host,
int port)
Creates a new ConnectionConfiguration for a connection that will connect
to the desired host and port.
|
ConnectionConfiguration(String host,
int port,
ProxyInfo proxy)
Creates a new ConnectionConfiguration for a connection that will connect
to the desired host and port with desired proxy.
|
ConnectionConfiguration(String host,
int port,
String serviceName)
Creates a new ConnectionConfiguration using the specified host, port and
service name.
|
ConnectionConfiguration(String host,
int port,
String serviceName,
ProxyInfo proxy)
Creates a new ConnectionConfiguration using the specified host, port and
service name.
|
ConnectionConfiguration(String serviceName,
ProxyInfo proxy)
Creates a new ConnectionConfiguration for the specified service name with
specified proxy.
|
| Modifier and Type | Method and Description |
|---|---|
CallbackHandler |
getCallbackHandler()
Returns a CallbackHandler to obtain information, such as the password or
principal information during the SASL authentication.
|
SSLContext |
getCustomSSLContext()
Gets the custom SSLContext for SSL sockets.
|
String |
getHost()
Returns the host to use when establishing the connection.
|
List<HostAddress> |
getHostAddresses() |
String |
getKeystorePath()
Retuns the path to the keystore file.
|
String |
getKeystoreType()
Returns the keystore type, or null if it's not set.
|
String |
getPKCS11Library()
Returns the PKCS11 library file location, needed when the Keystore type
is PKCS11.
|
int |
getPort()
Returns the port to use when establishing the connection.
|
RosterStore |
getRosterStore()
Get the permanent roster store
|
ConnectionConfiguration.SecurityMode |
getSecurityMode()
Returns the TLS security mode used when making the connection.
|
String |
getServiceName()
Returns the server name of the target server.
|
SocketFactory |
getSocketFactory()
Returns the socket factory used to create new xmppConnection sockets.
|
protected void |
init(String serviceName,
ProxyInfo proxy) |
boolean |
isCompressionEnabled()
Returns true if the connection is going to use stream compression.
|
boolean |
isDebuggerEnabled()
Returns true if the new connection about to be establish is going to be
debugged.
|
boolean |
isReconnectionAllowed()
Returns if the reconnection mechanism is allowed to be used.
|
boolean |
isRosterLoadedAtLogin()
Returns true if the roster will be loaded from the server when logging
in.
|
boolean |
isSASLAuthenticationEnabled()
Returns true if the client is going to use SASL authentication when
logging into the server.
|
void |
setCallbackHandler(CallbackHandler callbackHandler)
Sets a CallbackHandler to obtain information, such as the password or
principal information during the SASL authentication.
|
void |
setCompressionEnabled(boolean compressionEnabled)
Sets if the connection is going to use stream compression.
|
void |
setCustomSSLContext(SSLContext context)
Sets a custom SSLContext for creating SSL sockets.
|
void |
setDebuggerEnabled(boolean debuggerEnabled)
Sets if the new connection about to be establish is going to be debugged.
|
void |
setKeystorePath(String keystorePath)
Sets the path to the keystore file.
|
void |
setKeystoreType(String keystoreType)
Sets the keystore type.
|
void |
setPKCS11Library(String pkcs11Library)
Sets the PKCS11 library file location, needed when the Keystore type is
PKCS11
|
void |
setReconnectionAllowed(boolean isAllowed)
Sets if the reconnection mechanism is allowed to be used.
|
void |
setRosterLoadedAtLogin(boolean rosterLoadedAtLogin)
Sets if the roster will be loaded from the server when logging in.
|
void |
setRosterStore(RosterStore store)
Set the permanent roster store
|
void |
setSASLAuthenticationEnabled(boolean saslAuthenticationEnabled)
Sets whether the client will use SASL authentication when logging into
the server.
|
void |
setSecurityMode(ConnectionConfiguration.SecurityMode securityMode)
Sets the TLS security mode used when making the connection.
|
void |
setSendPresence(boolean sendPresence)
Sets if an initial available presence will be sent to the server.
|
void |
setServiceName(String serviceName)
Sets the server name, also known as XMPP domain of the target server.
|
void |
setSocketFactory(SocketFactory socketFactory)
Sets the socket factory used to create new xmppConnection sockets.
|
void |
setUsedHostAddress(HostAddress hostAddress) |
protected List<HostAddress> hostAddresses
protected ProxyInfo proxy
public ConnectionConfiguration(String serviceName)
serviceName - the name of the service provided by an XMPP server.public ConnectionConfiguration(String serviceName, ProxyInfo proxy)
serviceName - the name of the service provided by an XMPP server.proxy - the proxy through which XMPP is to be connectedpublic ConnectionConfiguration(String host, int port, String serviceName)
ConnectionConfiguration(String)
constructor. For example, say that an XMPP server is running at localhost
in an internal network on port 5222 but is configured to think that it's
"example.com" for testing purposes. This constructor is necessary to
connect to the server in that case since a DNS SRV lookup for example.com
would not point to the local testing server.host - the host where the XMPP server is running.port - the port where the XMPP is listening.serviceName - the name of the service provided by an XMPP server.public ConnectionConfiguration(String host, int port, String serviceName, ProxyInfo proxy)
ConnectionConfiguration(String)
constructor. For example, say that an XMPP server is running at localhost
in an internal network on port 5222 but is configured to think that it's
"example.com" for testing purposes. This constructor is necessary to
connect to the server in that case since a DNS SRV lookup for example.com
would not point to the local testing server.host - the host where the XMPP server is running.port - the port where the XMPP is listening.serviceName - the name of the service provided by an XMPP server.proxy - the proxy through which XMPP is to be connectedpublic ConnectionConfiguration(String host, int port)
host - the host where the XMPP server is running.port - the port where the XMPP is listening.public ConnectionConfiguration(String host, int port, ProxyInfo proxy)
host - the host where the XMPP server is running.port - the port where the XMPP is listening.proxy - the proxy through which XMPP is to be connectedpublic void setServiceName(String serviceName)
serviceName - the XMPP domain of the target server.public String getServiceName()
public String getHost()
service
name.public int getPort()
public void setUsedHostAddress(HostAddress hostAddress)
public ConnectionConfiguration.SecurityMode getSecurityMode()
ConnectionConfiguration.SecurityMode.enabled.public void setSecurityMode(ConnectionConfiguration.SecurityMode securityMode)
ConnectionConfiguration.SecurityMode.enabled.securityMode - the security mode.public String getKeystorePath()
public void setKeystorePath(String keystorePath)
keystorePath - the path to the keystore file.public String getKeystoreType()
public void setKeystoreType(String keystoreType)
keystoreType - the keystore type.public String getPKCS11Library()
public void setPKCS11Library(String pkcs11Library)
pkcs11Library - the path to the PKCS11 library filepublic SSLContext getCustomSSLContext()
public void setCustomSSLContext(SSLContext context)
context - the custom SSLContext for new sockets; null to reset default
behavior.public boolean isCompressionEnabled()
public void setCompressionEnabled(boolean compressionEnabled)
compressionEnabled - if the connection is going to use stream compression.public boolean isSASLAuthenticationEnabled()
public void setSASLAuthenticationEnabled(boolean saslAuthenticationEnabled)
saslAuthenticationEnabled - if the client is going to use SASL authentication when logging
into the server.public boolean isDebuggerEnabled()
Connection.DEBUG_ENABLED is
used.public void setDebuggerEnabled(boolean debuggerEnabled)
Connection.DEBUG_ENABLED is used.debuggerEnabled - if the new connection about to be establish is going to be
debugged.public void setReconnectionAllowed(boolean isAllowed)
isAllowed - if the reconnection mechanism is allowed to use.public boolean isReconnectionAllowed()
public void setSocketFactory(SocketFactory socketFactory)
socketFactory - used to create new sockets.public void setSendPresence(boolean sendPresence)
sendPresence - true if an initial available presence will be sent while
logging in.public boolean isRosterLoadedAtLogin()
public void setRosterLoadedAtLogin(boolean rosterLoadedAtLogin)
rosterLoadedAtLogin - if the roster will be loaded from the server when logging in.public CallbackHandler getCallbackHandler()
public void setCallbackHandler(CallbackHandler callbackHandler)
callbackHandler - to obtain information, such as the password or principal
information during the SASL authentication.public SocketFactory getSocketFactory()
public List<HostAddress> getHostAddresses()
public void setRosterStore(RosterStore store)
public RosterStore getRosterStore()
Copyright © 2014. All Rights Reserved.