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("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); }
XMPPConnection xmppCon; ConnectionConfiguration conf; SASLAuthentication.registerSASLMechanism("DIGEST-MD5", SASLDigestMD5Mechanism.class); SASLAuthentication.supportSASLMechanism("DIGEST-MD5", 0); conf = new ConnectionConfiguration(HOST, PORT);//, SERVICE); conf.setDebuggerEnabled(true); conf.setSASLAuthenticationEnabled(true); conf.setCompressionEnabled(true); conf.setSecurityMode(SecurityMode.enabled); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH){ conf.setTruststoreType("AndroidCAStore"); conf.setTruststorePassword(null); conf.setTruststorePath(null); }else{ conf.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"; } conf.setTruststorePath(path); } xmppCon = new XMPPConnection(conf);
ConnectionConfiguration cc = new ConnectionConfiguration(domain, port, service); // SASLAuthentication.supportSASLMechanism("PLAIN", 0); cc.setSASLAuthenticationEnabled(false); cc.setRosterLoadedAtLogin(true); cc.setCompressionEnabled(false); cc.setReconnectionAllowed(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { cc.setTruststoreType("AndroidCAStore"); cc.setTruststorePassword(null); cc.setTruststorePath(null); } else { cc.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"; } cc.setTruststorePath(path); } XMPPConnection connection = new XMPPConnection(cc); connection.login(username, password);
public XMPPConnection login() throws XMPPException { ConnectionConfiguration config = new ConnectionConfiguration("talk.google.com",5222,"gmail.com"); config.setSecurityMode(SecurityMode.required); config.setTruststoreType("BKS"); config.setTruststorePath("/system/etc/security/cacerts.bks"); XMPPConnection connection = new XMPPConnection(config); connection.connect(); connection.login(username, password); Presence presence = new Presence(Presence.Type.available); presence.setMode(Presence.Mode.available); connection.sendPacket(presence); try { Thread.sleep(3000); } catch (Exception ex) { ex.printStackTrace(); } return connection; }
config.setTruststoreType("AndroidCAStore"); config.setTruststorePassword(null); config.setTruststorePath(null); } else { config.setTruststoreType("BKS"); String path = System.getProperty("javax.net.ssl.trustStore"); if (path == null)
connectionConfig.setTruststoreType("AndroidCAStore"); connectionConfig.setTruststorePassword(null); connectionConfig.setTruststorePath(null);
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)
connConfig.setTruststoreType("AndroidCAStore"); connConfig.setTruststorePassword(null); connConfig.setTruststorePath(null); connConfig.setTruststoreType("BKS"); String path = System.getProperty("javax.net.ssl.trustStore"); if (path == null)
config.setTruststorePath("/system/etc/security/cacerts.bks"); config.setTruststorePassword("changeit"); config.setTruststoreType("bks"); config.setSendPresence(false); try {
config.setTruststorePath("/system/etc/security/cacerts.bks"); config.setTruststorePassword("changeit"); config.setTruststoreType("bks"); config.setSendPresence(false); try {