Feature/iotcore 113 clean code

Clean some errors detected by sonar, and make tests for error conditions: wrong payloads received as requests or wrong responses from the Keystone Proxy.