Fixed race condition in semaphore

Thread A: calls wait, decrements counter, but is unscheduled before calling Thread.stop
Thread B: calls signal, detects that count is < 0 so tries to wake a thread and finishes.
Thread A: calls Thread.stop
Fixed bug when starting torrent
Fixed issue where thread calling PeerClient.torrentData could block indefinitely

The calling thread would get stuck in Semaphore.wait forever. It seems like the
problem was a race condition in Reactor where it could peek at the next timer
in the TimerManager and then try to remove it, but between the two operations
a timer may have been added by another thread to the head of the list, meaning
the wrong timer is removed. In this case the removed timer would never fire.

In case there is another race condition, the Semaphore class was modified to
have a timed wait method which the torrentData method uses. TimerManager
was also refactored to it's own class and more testcases were added.