wip/ move write/read to server.go and add test