implement awaitConnection