fixed test
do not use strip on write because strip will remove the following whitespace if msg="test ", replaced necessary strip by rstrip+read for end of line