refactor/combine encoder/decoder
fix some names
update client.go
cleanup
update server code
fix buffer issue
fix flush issue