Currently ClientContextFactory.connect() returns already a CompletableFuture, which is resolved when the ClientContext is ready. During the initialization, we invoke "initClientContext", but we do it synchronously. It can be done asynchronously without changing the public API.
To do this we should create a ClientContextFactory, which has a method createClientContext() that returns a CompletableFuture. The creation of ClientContextImpl has to be separated into two parts. Invoking "initClientContext" has to be pulled out of the constructor and done separately in the factory method. The factory method resolves the CompletableFuture once the invokation of "initClientContext" returns.
ClientContextFactory finishes the initialization after the CompletableFuture from ClientContextFactory is completed and resolves its own CompletableFuture once everything is done.