state machine echo protocol