Tidy up stream test harness & fix race conditions
Merge pull request #432 from leth/fix_test_race

Tidy up stream test harness & fix race conditions