state machine
Protocol unittest