@Override
    public void registerCloseListener(ConnectionCloseListener listener, Object callback) {
        if (isClosed()) {
            listener.onConnectionClosing(callback).join();
        }
        else {
            closeListeners.put( listener, callback );
        }
    }
Returns the session that owns this connection, if the connection has been initialized.

@return session that owns this connection.
xmppserver/src/main/java/org/jivesoftware/openfire/net/AbstractConnection.java