test tcp read and write in same thread