[CoAP] cleaned code by using partial template specialization