add test and fix bug of httpserver and socket encode problem