fix race condition in tests, make test helpers compile for tests only
fix race condition in listener.go
Merge pull request #17 from kornel661/master

race conditions fixes