Move handling of incoming ping into Connection.get_messages()