@Override
    public void reinit(final LocalSession owner)
    {
        this.session = owner;

        // ConnectionCloseListeners are registered with their session instance as a callback object. When re-initializing,
        // this object needs to be replaced with the new session instance (or otherwise, the old session will be used
        // during the callback. OF-2014
        closeListeners.entrySet().stream()
            .filter(entry -> entry.getValue() instanceof LocalSession)
            .forEach(entry -> entry.setValue(owner));
    }
The session that owns this connection.
xmppserver/src/main/java/org/jivesoftware/openfire/net/AbstractConnection.java