Refactor client sync code, more client tests
Fix #30 - Add protection against permanent sync locking

A client used to be able to hold the server hostage, preventing other clients from doing an upstream sync, if they disconnected during their sync. This fixes that problem.
Update unit tests for sync locking.
Fixes #11 - Server side client-to-server testing
Review fix for locking logic
Review fixes for unit tests
Fixes after rebase