rewrite protocol check with switch-case in Server.Daemon

ping @vieux