Main app fully converted into a spec

I had an issue with the «disconnet» message: I forgot to encode its
remaining lenght, which is always 0. I saw the message going to the
server with «wireshark» but I did'nt realize that instead of being
«e4» it should have been «e400». «Mosquitto» silently discarded it
which is what confused (disapointed) me the most!