public void reattach(LocalSession connectionProvider, long h) {
        lock.lock();
        try {
            Log.debug("Reattaching session with address {} and streamID {} using connection from session with address {} and streamID {}.", this.address, this.streamID, connectionProvider.getAddress(), connectionProvider.getStreamID());
            if (this.conn != null && !this.conn.isClosed())
            {
                this.conn.close(new StreamError(StreamError.Condition.conflict, "The stream previously served over this connection is resumed on a new connection."));
            }
            this.conn = connectionProvider.releaseConnection();
            this.conn.reinit(this);
        }finally {
            lock.unlock();
        }
        this.status = Session.Status.AUTHENTICATED;
        this.sessionManager.removeDetached(this);
        this.streamManager.onResume(new JID(null, this.serverName, null, true), h);
        this.sessionManager.removeSession((LocalClientSession)connectionProvider);
    }
Reattach the (existing) session to the connection provided by a new session (a session that will be replaced
by the older, pre-existing session). The connection must already be initialized as a running XML Stream, normally
by having run through XEP-0198 resumption.

@param connectionProvider Session from which to obtain the connection from.
@param h the sequence number of the last handled stanza sent over the former stream
xmppserver/src/main/java/org/jivesoftware/openfire/session/LocalSession.java