/** * Creates a new XMPP connection using the specified connection configuration.<p> * <p/> * Manually specifying connection configuration information is suitable for * advanced users of the API. In many cases, using the * {@link #XMPPConnection(String)} constructor is a better approach.<p> * <p/> * Note that XMPPConnection constructors do not establish a connection to the server * and you must call {@link #connect()}.<p> * <p/> * * The CallbackHandler will only be used if the connection requires the client provide * an SSL certificate to the server. The CallbackHandler must handle the PasswordCallback * to prompt for a password to unlock the keystore containing the SSL certificate. * * @param config the connection configuration. * @param callbackHandler the CallbackHandler used to prompt for the password to the keystore. */ public XMPPConnection(ConnectionConfiguration config, CallbackHandler callbackHandler) { super(config); config.setCallbackHandler(callbackHandler); }
/** * Creates a new XMPP connection using the specified connection configuration.<p> * <p/> * Manually specifying connection configuration information is suitable for * advanced users of the API. In many cases, using the * {@link #XMPPConnection(String)} constructor is a better approach.<p> * <p/> * Note that XMPPConnection constructors do not establish a connection to the server * and you must call {@link #connect()}.<p> * <p/> * * The CallbackHandler will only be used if the connection requires the client provide * an SSL certificate to the server. The CallbackHandler must handle the PasswordCallback * to prompt for a password to unlock the keystore containing the SSL certificate. * * @param config the connection configuration. * @param callbackHandler the CallbackHandler used to prompt for the password to the keystore. */ public XMPPConnection(ConnectionConfiguration config, CallbackHandler callbackHandler) { super(config); config.setCallbackHandler(callbackHandler); }
/** * Creates a new XMPP connection using the specified connection configuration.<p> * <p/> * Manually specifying connection configuration information is suitable for * advanced users of the API. In many cases, using the * {@link #XMPPConnection(String)} constructor is a better approach.<p> * <p/> * Note that XMPPConnection constructors do not establish a connection to the server * and you must call {@link #connect()}.<p> * <p/> * * The CallbackHandler will only be used if the connection requires the client provide * an SSL certificate to the server. The CallbackHandler must handle the PasswordCallback * to prompt for a password to unlock the keystore containing the SSL certificate. * * @param config the connection configuration. * @param callbackHandler the CallbackHandler used to prompt for the password to the keystore. */ public XMPPConnection(ConnectionConfiguration config, CallbackHandler callbackHandler) { super(config); config.setCallbackHandler(callbackHandler); }
@Override public XMPPConnection createConnection( final ConnectionConfiguration config) { config.setCallbackHandler(this); final XMPPConnection conn = new XMPPConnection(config); // This just adds oauth2 to the mechanisms we support. SASLAuthentication.supportSASLMechanism("X-OAUTH2"); return conn; }
/** * Creates a new connection to the specified XMPP server. A DNS SRV lookup will be * performed to determine the IP address and port corresponding to the * service name; if that lookup fails, it's assumed that server resides at * <tt>serviceName</tt> with the default port of 5222. Encrypted connections (TLS) * will be used if available, stream compression is disabled, and standard SASL * mechanisms will be used for authentication.<p> * <p/> * This is the simplest constructor for connecting to an XMPP server. Alternatively, * you can get fine-grained control over connection settings using the * {@link #XMPPConnection(ConnectionConfiguration)} constructor.<p> * <p/> * Note that XMPPConnection constructors do not establish a connection to the server * and you must call {@link #connect()}.<p> * <p/> * The CallbackHandler will only be used if the connection requires the client provide * an SSL certificate to the server. The CallbackHandler must handle the PasswordCallback * to prompt for a password to unlock the keystore containing the SSL certificate. * * @param serviceName the name of the XMPP server to connect to; e.g. <tt>example.com</tt>. * @param callbackHandler the CallbackHandler used to prompt for the password to the keystore. */ public XMPPConnection(String serviceName, CallbackHandler callbackHandler) { // Create the configuration for this new connection super(new ConnectionConfiguration(serviceName)); config.setCompressionEnabled(false); config.setSASLAuthenticationEnabled(true); config.setDebuggerEnabled(DEBUG_ENABLED); config.setCallbackHandler(callbackHandler); }
/** * Creates a new connection to the specified XMPP server. A DNS SRV lookup will be * performed to determine the IP address and port corresponding to the * service name; if that lookup fails, it's assumed that server resides at * <tt>serviceName</tt> with the default port of 5222. Encrypted connections (TLS) * will be used if available, stream compression is disabled, and standard SASL * mechanisms will be used for authentication.<p> * <p/> * This is the simplest constructor for connecting to an XMPP server. Alternatively, * you can get fine-grained control over connection settings using the * {@link #XMPPConnection(ConnectionConfiguration)} constructor.<p> * <p/> * Note that XMPPConnection constructors do not establish a connection to the server * and you must call {@link #connect()}.<p> * <p/> * The CallbackHandler will only be used if the connection requires the client provide * an SSL certificate to the server. The CallbackHandler must handle the PasswordCallback * to prompt for a password to unlock the keystore containing the SSL certificate. * * @param serviceName the name of the XMPP server to connect to; e.g. <tt>example.com</tt>. * @param callbackHandler the CallbackHandler used to prompt for the password to the keystore. */ public XMPPConnection(String serviceName, CallbackHandler callbackHandler) { // Create the configuration for this new connection super(new ConnectionConfiguration(serviceName)); config.setCompressionEnabled(false); config.setSASLAuthenticationEnabled(true); config.setDebuggerEnabled(DEBUG_ENABLED); config.setCallbackHandler(callbackHandler); }
/** * Creates a new connection to the specified XMPP server. A DNS SRV lookup will be * performed to determine the IP address and port corresponding to the * service name; if that lookup fails, it's assumed that server resides at * <tt>serviceName</tt> with the default port of 5222. Encrypted connections (TLS) * will be used if available, stream compression is disabled, and standard SASL * mechanisms will be used for authentication.<p> * <p/> * This is the simplest constructor for connecting to an XMPP server. Alternatively, * you can get fine-grained control over connection settings using the * {@link #XMPPConnection(ConnectionConfiguration)} constructor.<p> * <p/> * Note that XMPPConnection constructors do not establish a connection to the server * and you must call {@link #connect()}.<p> * <p/> * The CallbackHandler will only be used if the connection requires the client provide * an SSL certificate to the server. The CallbackHandler must handle the PasswordCallback * to prompt for a password to unlock the keystore containing the SSL certificate. * * @param serviceName the name of the XMPP server to connect to; e.g. <tt>example.com</tt>. * @param callbackHandler the CallbackHandler used to prompt for the password to the keystore. */ public XMPPConnection(String serviceName, CallbackHandler callbackHandler) { // Create the configuration for this new connection super(new ConnectionConfiguration(serviceName)); config.setCompressionEnabled(false); config.setSASLAuthenticationEnabled(true); config.setDebuggerEnabled(DEBUG_ENABLED); config.setCallbackHandler(callbackHandler); }
config.setTruststorePath(truststorepath); config.setTruststorePassword(truststorepass); config.setCallbackHandler(this);