public void connectionCreated(final XMPPConnection connection) { // create the manager for this connection InBandBytestreamManager.getByteStreamManager(connection); // register shutdown listener connection.addConnectionListener(new AbstractConnectionClosedListener() { @Override public void connectionTerminated() { InBandBytestreamManager.getByteStreamManager(connection).disableService(); } @Override public void reconnectionSuccessful() { // re-create the manager for this connection InBandBytestreamManager.getByteStreamManager(connection); } }); }
/** * Configure a session, setting some action listeners... * * @param connection * The connection to set up */ private void installConnectionListeners(final XMPPConnection connection) { if (connection != null) { connectionListener = new AbstractConnectionClosedListener() { @Override public void connectionTerminated() { unregisterInstanceFor(connection); } }; connection.addConnectionListener(connectionListener); } }