Ensuring Quality of Service in the Internet of Things