This is a demo template that use twisted to write a socket connection program with finite state machine