More unit tests for QuorumZab and change from CountDownLatch to Semaphore

Currently we use CountDownLatch to wait for some specific events happen in unit test. It has some problems. For example, if in the test I have two places to wait for server1 enters broadcasting phase.
```
cb1.waitForBroadcasting()
...
//server1 crashed
...
cb1.waitForBroadcasting()
``` 
I can't just initialize CountDownLatch to 2. I think Semaphore should be a good fit for this purpose.