Refine search
ConnectionConfiguration connFig = new ConnectionConfiguration(SERVER, PORT); connFig.setSASLAuthenticationEnabled(true); connection = new XMPPConnection(connFig); connection.connect(); return true; } catch (XMPPException e) { e.printStackTrace(); connection.disconnect(); connection.disconnect();
public XmppConnectionFactoryBean xmppConnectionFactoryBean(){ ConnectionConfiguration configuration = new ConnectionConfiguration(host, port); configuration.setSecurityMode(SecurityMode.enabled); configuration.setReconnectionAllowed(true); configuration.setRosterLoadedAtLogin(false); configuration.setSendPresence(false); configuration.setSocketFactory(SSLSocketFactory.getDefault());
/** * 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("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 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");
config = new ConnectionConfiguration(Util.FCM_SERVER, Util.FCM_PORT); config.setSecurityMode(SecurityMode.enabled); config.setReconnectionAllowed(true); config.setRosterLoadedAtLogin(false); config.setSendPresence(false); config.setSocketFactory(SSLSocketFactory.getDefault()); config.setDebuggerEnabled(mDebuggable); connection = new XMPPConnection(config); connection.connect(); connection.addConnectionListener(new ConnectionListener() {
if (xmppConnection == null || !xmppConnection.isAuthenticated() || !xmppConnection.isConnected()) { String user = null; String pass = null; if (xmppConnection != null) { try { xmppConnection.disconnect(); } catch (Exception e) { ConnectionConfiguration config = new ConnectionConfiguration(server, port); config.setDebuggerEnabled(debuggerEnabled); config.setReconnectionAllowed(true); config.setSASLAuthenticationEnabled(true); SASLAuthentication.supportSASLMechanism("PLAIN"); config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled); xmppConnection = new XMPPConnection(config); xmppConnection.connect();
public synchronized void sendTo(final String recipient, final String message) throws XMPPException { log.info(String.format("%s: %s", recipient, message)); XMPPConnection connection = new XMPPConnection(new ConnectionConfiguration("talk.google.com", 5222, "gmail.com")); if (connection.isConnected() == false) { connection.connect(); } if (connection.isAuthenticated() == false) { SASLAuthentication.supportSASLMechanism("PLAIN", 0); connection.login(userName, password); connection.sendPacket(new Presence(Presence.Type.available)); } Message jabberMessage = new Message(recipient, Message.Type.chat); jabberMessage.setBody(message); connection.sendPacket(jabberMessage); connection.disconnect(new Presence(Presence.Type.unavailable)); } }
ConnectionConfiguration config = new ConnectionConfiguration(server, port); config.setCompressionEnabled(true); config.setSASLAuthenticationEnabled(true); config.setKeystorePath(keystorepath); config.setKeystoreType(keystoretype); config.setTruststorePath(truststorepath); config.setTruststorePassword(truststorepass); config.setCallbackHandler(this); config.setSecurityMode(SecurityMode.enabled); SASLAuthentication.supportSASLMechanism("EXTERNAL"); config.setReconnectionAllowed(true); config.setRosterLoadedAtLogin(true); xmppCon = new XMPPConnection(config, this); xmppCon.connect(); String usingTLS = (xmppCon.isUsingTLS() == true) ? "" : " *NOT* "; String secure = (xmppCon.isSecureConnection() == true) ? "" : " *NOT* "; logger.info("Connection is "
ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222); config.setSASLAuthenticationEnabled(true); config.setSecurityMode(SecurityMode.required); config.setRosterLoadedAtLogin(true); config.setTruststorePath("/system/etc/security/cacerts.bks"); config.setTruststorePassword("changeit"); config.setTruststoreType("bks"); config.setSendPresence(false); try { SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, MemorizingTrustManager.getInstanceList(this), new java.security.SecureRandom()); config.setCustomSSLContext(sc); } catch (GeneralSecurityException e) { Log.w("TAG", "Unable to use MemorizingTrustManager", e); xmpp.connect(); xmpp.login("facebookusername", "****"); // Here you have to used only facebookusername from facebookusername@chat.facebook.com Roster roster = xmpp.getRoster(); Collection<RosterEntry> entries = roster.getEntries(); System.out.println("Connected!");
ConnectionConfiguration cc = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com"); XMPPConnection connection = new XMPPConnection(cc); try { connection.connect(); // You have to put this code before you login SASLAuthentication.supportSASLMechanism("PLAIN", 0); // You have to specify your gmail addres WITH @gmail.com at the end connection.login("some.account@gmail.com", "password", "resource"); // See if you are authenticated System.out.println(connection.isAuthenticated()); } catch (XMPPException e1) { e1.printStackTrace(); }
try { ConnectionConfiguration connConfig = new ConnectionConfiguration("HOST_IP", Integer.parseInt("PORT_NO")); XMPPConnection connection = new XMPPConnection(connConfig); connection.connect(); try { // Login connection.login("USER_NAME", "PASSWORD"); // Set the status to available Presence presence = new Presence(Presence.Type.available); connection.sendPacket(presence); xmppClient.setConnection(connection); } catch (XMPPException ex) { Log.w("XMPPClient", "[SettingsDialog] Failed to log in as " + username); Log.w("XMPPClient", ex.toString()); xmppClient.setConnection(null); } } catch (XMPPException ex) { Log.w("XMPPClient", "[SettingsDialog] Failed to connect to " + connection.getHost()); Log.w("XMPPClient", ex.toString()); xmppClient.setConnection(null); }
ConnectionConfiguration connConfig = new ConnectionConfiguration(host, portInt,service); connConfig.setSASLAuthenticationEnabled(true); connConfig.setSecurityMode(SecurityMode.enabled); connConfig.setTruststoreType("AndroidCAStore"); connConfig.setTruststorePassword(null); connConfig.setTruststorePath(null); Log.i("XMPP", "Build Icecream"); connConfig.setTruststoreType("BKS"); String path = System.getProperty("javax.net.ssl.trustStore"); if (path == null) + File.separator + "security" + File.separator + "cacerts.bks"; connConfig.setTruststorePath(path); Log.i("XMPP", "Build less than Icecream "); connConfig.setDebuggerEnabled(true); XMPPConnection.DEBUG_ENABLED = true; XMPPConnection connection = new XMPPConnection(connConfig); connection.connect(); Log.i("XMPP", "Connected to " + connection.getHost()); Log.e("XMPP", "Failed to connect to " + connection.getHost()); Log.e("XMPP", ex.toString());
ConnectionConfiguration config = new ConnectionConfiguration(server, port); config.setCompressionEnabled(true); xmppCon = new XMPPConnection(config); try { xmppCon.connect(); accountManager.createAccount(user, password); } catch (XMPPException e) { XMPPError error = e.getXMPPError(); if (error != null) { errorCode = error.getCode(); if ((xmppCon != null) && (xmppCon.isConnected())){ try { xmppCon.disconnect();
ConnectionConfiguration connConfig = new ConnectionConfiguration("ip", 5222); XMPPConnection connection = new XMPPConnection(connConfig); connection.connect(); connection.login("username", "password"); AccountManager accountManager = connection.getAccountManager(); accountManager.createAccount("adminCreated1", "123456"); connection.disconnect();
ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222); config.setDebuggerEnabled(true); config.setSASLAuthenticationEnabled(true); config.setSecurityMode(ConnectionConfiguration.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) + File.separator + "security" + File.separator + "cacerts.bks"; config.setTruststorePath(path); xmpp.connect(); "Unable to " + xmpp.getHost()); e1.printStackTrace(); e.printStackTrace();
public void run() { ConnectionConfiguration connConfig = new ConnectionConfiguration( HOST, PORT); connConfig.setReconnectionAllowed(true); XMPPConnection connection = new XMPPConnection(connConfig); try { connection.connect(); Log.i("XMPPChatDemoActivity", "Connected to " + connection.getHost()); + connection.getHost()); Log.e("XMPPChatDemoActivity", ex.toString());
if (xmppAccount != null) { try { ConnectionConfiguration config = new ConnectionConfiguration(XmppConfig.getInstance().getHost(), XmppConfig.getInstance().getPort(), "Accounts"); XMPPConnection xmppConnection = new XMPPConnection(config); xmppConnection.connect(); xmppConnection.login(XmppConfig.getInstance().getUsername(), XmppConfig.getInstance().getPassword()); AccountManager accountManager = xmppConnection.getAccountManager(); Map<String, String> attributes = new HashMap<>(); return true; } catch (XMPPException e) { if (e.getXMPPError().getCode() == 409) { "XMPP account creation failed. Error: " + e.getLocalizedMessage(), e);
String user_name = StringUtils.parseName(userName); ConnectionConfiguration config = new ConnectionConfiguration(mHost, 5222, service); config.setSendPresence(true); config.setDebuggerEnabled(false); connection.connect(); connection.login(user_name, password); Chat chat = connection.getChatManager().createChat(to, this); chat.sendMessage(message);
m_connection.sendPacket(msg); m_discussionThread.add("moi :"); m_discussionThread.add(text); protected Void doInBackground(Void... params) { try { ConnectionConfiguration config = new ConnectionConfiguration(SERVER_HOST, SERVER_PORT, SERVICE_NAME); m_connection = new XMPPConnection(config); m_connection.connect(); m_connection.login(LOGIN, PASSWORD); Presence presence = new Presence(Presence.Type.available); m_connection.sendPacket(presence); e.printStackTrace();