move retry logic so that it applies when creating any connection