first test whether unix socket exists or not, then remove it
rewrite protocol check with switch-case