protected CompletableFuture<?> notifyCloseListeners()
    {
        Log.debug("Notifying close listeners of connection {}", this);
        final ArrayList<CompletableFuture<?>> futures = new ArrayList<>();

        for (final Map.Entry<ConnectionCloseListener, Object> entry : closeListeners.entrySet() )
        {
            final ConnectionCloseListener listener = entry.getKey();
            if (listener != null) {
                final Object handback = entry.getValue();
                futures.add(listener.onConnectionClosing(handback));
            }
        }

        return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
    }
Notifies all close listeners that the connection has been closed. Used by subclasses to properly finish closing
the connection.

@return A Future that represents the state of the close listeners invocations.
xmppserver/src/main/java/org/jivesoftware/openfire/net/AbstractConnection.java