copy fron http://code.taobao.org/p/myrelay/wiki/index/， and do some special changes