connect to a proper endpoint