Use autoconnect in ping function to make sure we have opened connection.