Resolved the ClientEndpoint memory leak.

The ClientEndpoints are now created when the authentication is done instead
of creating lazily, because with this approach it is possible that an endpoint
of a dead connection is recreated after it has been removed. And this can lead
to a memory leak.