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(); }
} catch (XMPPException e) { e.printStackTrace(); connection.disconnect(); connection.disconnect(); return true; } catch (XMPPException e) { connection.disconnect(); e.printStackTrace();
/** * Close the XMPP connection * * @throws NotConnectedException */ public void disconnect() throws NotConnectedException { connection.disconnect(); }
@Override public void logout() { this.loggedOut.set(true); if (this.xmppConnection != null) { this.xmppConnection.disconnect(); } }
/** * */ protected void logout() { try { xmppCon.disconnect(); } catch (NullPointerException npe) { logger.error("Working around NPE in Smack libraries at connection disconnect."); xmppCon = null; } }
/** * disconnect google talk notification */ public void disconnect() { LOG.info("Disconnect from {}", GOOGLE_TALK_URL + ":" + GOOGLE_TALK_PORT + "[" + GOOGLE_TALK_SERVICE + "] ..."); xmppConnection.disconnect(); }
@Override public void logout() { this.loggedOut.set(true); if (this.xmppConnection != null) { this.xmppConnection.disconnect(); } }
@Override public void onDestroy() { if (mNotificationManager != null) { mNotificationManager = null; } try { if (mXMPPConnection != null) { mXMPPConnection.disconnect(); mXMPPConnection = null; } if (mXmppConnectionManager != null) { mXmppConnectionManager = null; } } catch (Exception e) { e.printStackTrace(); } super.onDestroy(); } }
public void destroy() { if(xmppConnection != null && xmppConnection.isConnected()){ xmppConnection.disconnect(); } }
@Override protected void doDisconnect() throws Exception { if (connection.isConnected()) { connection.disconnect(); } }
@Override public void stop() { logout(); this.xmppConnection.disconnect(); } }
public void destroy() { if(xmppConnection != null && xmppConnection.isConnected()){ xmppConnection.disconnect(); } }
@Override public void stop() { logout(); this.xmppConnection.disconnect(); } }
/** * {@inheritDoc} */ @Override public void destroy() { super.destroy(); synchronized (xmppConnection) { if (xmppConnection != null) { xmppConnection.disconnect(); } } }
@Override /** * */ protected void finalize() throws Throwable { //logger.info("Disconnecting from XMPP server"); if ((xmppCon != null) && (xmppCon.isConnected())) try { xmppCon.disconnect(); } catch (NullPointerException npe) { logger.error("Working around NPE in Smack libraries at connection disconnect."); xmppCon = null; } }
/** Destroy the connection */ public void destroy() throws Exception { if (connection != null && connection.isConnected()) { stopPingTask(); connection.disconnect(); } }
/** * Disconnects from chatserver and releases all resources. */ public void disconnect() { connection.getRoster().removeRosterListener(leagueRosterListener); try { connection.disconnect(); } catch (final NotConnectedException e) { e.printStackTrace(); } stop = true; }
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.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(); }
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)); } }