Added CmdServer tests & fixed bugs revealed.
Added processCmds method
Fixed recv on closed socket bug; use processCmds