How can I Gracefully Shutdown the Client?

How can I gracefully shutdown/close the Client/Session?

For some reason the application continues running even after the CompletableFuture returns the ExitInfo. I’ve tried providing my own ExecutorService and calling shutdown()/awaitTermination()/shutdownNow(), but something else is keeping the application alive.

Below is an example of my main method. The OnJoinListener calls Session.close(). Having all 4 listeners added, I can verify that Connect -> Join -> Leave -> Disconnect occurs.

public static void main(String[] args)
    ExecutorService executor = Executors.newSingleThreadExecutor();

    Session session = new Session(executor);

    Client client = new Client(session, "ws://localhost:8080", "development", executor);

    CompletableFuture<ExitInfo> exitFuture = client.connect();
    ExitInfo exitInfo = exitFuture.get();

    executor.awaitTermination(5, TimeUnit.SECONDS);