ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222); config.setSASLAuthenticationEnabled(true); XMPPConnection xmpp = new XMPPConnection(config); try { SASLAuthentication.registerSASLMechanism("X-FACEBOOK-PLATFORM", SASLXFacebookPlatformMechanism.class); SASLAuthentication.supportSASLMechanism("X-FACEBOOK-PLATFORM", 0); xmpp.connect(); xmpp.login(apiKey + "|" + sessionKey, sessionSecret, "Application"); } catch (XMPPException e) { xmpp.disconnect(); e.printStackTrace(); }
ConnectionConfiguration connConfig = new ConnectionConfiguration(host,port,host); connection = new XMPPConnection(connConfig); connConfig.setSASLAuthenticationEnabled(true); connection.connect(); connection.login(userID, password);
ConnectionConfiguration config = new ConnectionConfiguration("mwbn43-1", 5222); config.setSASLAuthenticationEnabled(false); XMPPConnection xmpp = new XMPPConnection(config);
ConnectionConfiguration config = new ConnectionConfiguration(XMPP_HOST, XMPP_PORT); config.setCompressionEnabled(false); config.setSASLAuthenticationEnabled(false); connection = new XMPPConnection(config);
ConnectionConfiguration connFig = new ConnectionConfiguration(SERVER, PORT); connFig.setSASLAuthenticationEnabled(true); connection = new XMPPConnection(connFig);
public void login(String userName, String password) throws XMPPException { SASLAuthentication.registerSASLMechanism("DIGEST-MD5",MySASLDigestMD5Mechanism. class); ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com",5222); config.setSASLAuthenticationEnabled(true); config.setRosterLoadedAtLogin (true); connection = new XMPPConnection(config); connection.connect(); connection.login(userName, password); }
ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222); config.setSASLAuthenticationEnabled(true); mFbConnection = new XMPPConnection(config); try { SASLAuthentication.registerSASLMechanism("X-FACEBOOK-PLATFORM", SASLXFacebookPlatformMechanism.class); SASLAuthentication.supportSASLMechanism("X-FACEBOOK-PLATFORM", 0); mFbConnection.connect(); mFbConnection.login(apiKey, accessToken, "Application"); } catch (XMPPException e) { mFbConnection.disconnect(); e.printStackTrace(); }
/* this config I missed out */ ConnectionConfiguration config = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com"); config.setCompressionEnabled(true); config.setSASLAuthenticationEnabled(false); connection = new XMPPConnection(config);
ConnectionConfiguration config; config = new ConnectionConfiguration(ip, port, "Smack"); config.setSASLAuthenticationEnabled(false); config.setReconnectionAllowed(true); config.setCompressionEnabled(false); config.setDebuggerEnabled(true); connection = new XMPPConnection(config); connection.connect(); if (connection.isConnected()) { connection.login(loginName, password); }
SmackConfiguration.setPacketReplyTimeout(15000); ConnectionConfiguration connectionConfig = new ConnectionConfiguration(host, port); connectionConfig.setRosterLoadedAtLogin(true); connectionConfig.setSendPresence(true); connectionConfig.setSASLAuthenticationEnabled(false); connectionConfig.setReconnectionAllowed(true); connection = new XMPPConnection(connectionConfig);
// Create the configuration for this new connection ConnectionConfiguration config = new ConnectionConfiguration("jabber.org", 5222); config.setCompressionEnabled(true); config.setSASLAuthenticationEnabled(true); Connection connection = new XMPPConnection(config); // Connect to the server connection.connect(); // Log into the server connection.login("danilodeveloper", "password", "SomeResource"); // getting the Openfire contacts that danilodeveloper has Roster roster = connection.getRoster(); // the contacts Collection<RosterEntry> entries = roster.getEntries();
private final static String server_host = "talk.google.com"; private final static int SERVER_PORT = 5222; private final static String SERVICE_NAME = "gmail.com"; ConnectionConfiguration config = new ConnectionConfiguration( server_host, SERVER_PORT , SERVICE_NAME); XMPPConnection m_connection = new XMPPConnection(config); try { SASLAuthentication.supportSASLMechanism("PLAIN"); config.setSASLAuthenticationEnabled(true); m_connection.connect(); Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.manual); } catch (XMPPException e) { e.printStackTrace(); }
ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222); config.setSASLAuthenticationEnabled(true); config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled); XMPPConnection xmpp = new XMPPConnection(config); SASLAuthentication.registerSASLMechanism("X-FACEBOOK-PLATFORM",SASLXFacebookPlatformMechanism.class); SASLAuthentication.supportSASLMechanism("X-FACEBOOK-PLATFORM", 0); xmpp.connect(); xmpp.login(appSecret, accessToken, "Application");
/** * Creates a new XMPP connection in the same way {@link #XMPPConnection(String,CallbackHandler)} does, but * with no callback handler for password prompting of the keystore. This will work * in most cases, provided the client is not required to provide a certificate to * the server. * * @param serviceName the name of the XMPP server to connect to; e.g. <tt>example.com</tt>. */ public XMPPConnection(String serviceName) { // Create the configuration for this new connection super(new ConnectionConfiguration(serviceName)); config.setCompressionEnabled(false); config.setSASLAuthenticationEnabled(true); config.setDebuggerEnabled(DEBUG_ENABLED); }
/** * Creates a new XMPP connection in the same way {@link #XMPPConnection(String,CallbackHandler)} does, but * with no callback handler for password prompting of the keystore. This will work * in most cases, provided the client is not required to provide a certificate to * the server. * * @param serviceName the name of the XMPP server to connect to; e.g. <tt>example.com</tt>. */ public XMPPConnection(String serviceName) { // Create the configuration for this new connection super(new ConnectionConfiguration(serviceName)); config.setCompressionEnabled(false); config.setSASLAuthenticationEnabled(true); config.setDebuggerEnabled(DEBUG_ENABLED); }
/** * Creates a new XMPP connection in the same way {@link #XMPPConnection(String,CallbackHandler)} does, but * with no callback handler for password prompting of the keystore. This will work * in most cases, provided the client is not required to provide a certificate to * the server. * * @param serviceName the name of the XMPP server to connect to; e.g. <tt>example.com</tt>. */ public XMPPConnection(String serviceName) { // Create the configuration for this new connection super(new ConnectionConfiguration(serviceName)); config.setCompressionEnabled(false); config.setSASLAuthenticationEnabled(true); config.setDebuggerEnabled(DEBUG_ENABLED); }
ConnectionConfiguration config = new ConnectionConfiguration("your_server", port_no); config.setSASLAuthenticationEnabled(true); config.setCompressionEnabled(true); config.setSecurityMode(SecurityMode.enabled); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { config.setTruststoreType("AndroidCAStore"); config.setTruststorePassword(null); config.setTruststorePath(null); } else { config.setTruststoreType("BKS"); String path = System.getProperty("javax.net.ssl.trustStore"); if (path == null) path = System.getProperty("java.home") + File.separator + "etc" + File.separator + "security" + File.separator + "cacerts.bks"; config.setTruststorePath(path); }
ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222); config.setSASLAuthenticationEnabled(true); XMPPConnection xmpp = new XMPPConnection(config); try { SASLAuthentication.registerSASLMechanism("X-FACEBOOK-PLATFORM", SASLXFacebookPlatformMechanism.class); SASLAuthentication.supportSASLMechanism("X-FACEBOOK-PLATFORM", 0); xmpp.connect(); xmpp.login(apiKey + "|" + sessionKey, sessionSecret, "Application"); } catch (XMPPException e) { xmpp.disconnect(); e.printStackTrace(); }
ConnectionConfiguration config = new ConnectionConfiguration("your_server", port_no); config.setSASLAuthenticationEnabled(true); config.setCompressionEnabled(true); config.setSecurityMode(SecurityMode.enabled); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { config.setTruststoreType("AndroidCAStore"); config.setTruststorePassword(null); config.setTruststorePath(null); } else { config.setTruststoreType("BKS"); String path = System.getProperty("javax.net.ssl.trustStore"); if (path == null) path = System.getProperty("java.home") + File.separator + "etc" + File.separator + "security" + File.separator + "cacerts.bks"; config.setTruststorePath(path); }
ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration("localhost", 5222); connectionConfiguration.setSecurityMode(ConnectionConfiguration.SecurityMode.required); connectionConfiguration.setSASLAuthenticationEnabled(true); connectionConfiguration.setKeystorePath("src/main/resources/bogus_mina_tls.cert"); connectionConfiguration.setTruststorePath("src/main/resources/bogus_mina_tls.cert"); connectionConfiguration.setTruststorePassword("boguspw");