Properly fix #41. Simply adding a non-atomic boolean check doesn't actually resolve that issue, just made it less likely to happen. This patch makes the client use proper Java Lock objects to maintain synchronicity
Merge pull request #43 from AgentK20/master

Properly fix #41.