Cognitive Routing for Improvement of IoT Security