Replace sleeps with wait_for_reader/wait_for_writer in tests
Replace sleeps with wait_for_reader/wait_for_writer in tests

This fixes the race conditions occurring in the unit tests.

tylertreat/chan,grafov/chan,tempbottle/chan,tempbottle/chan,1514louluo/chan,tylertreat/chan,1514louluo/chan,grafov/chan,grafov/chan,1514louluo/chan,tylertreat/chan,tempbottle/chan