Fix an issue where the client will attempt to read too many varints

In Java the condition in a for loop is calculated after every loop run. If there is enough properties to justify another loop, the client will attempt to read another varint which isn't there. I fixed this by reading the number of properties prior to the for loop.
Merge pull request #40 from marcusant/patch-1

Fix an issue where the client will attempt to read too many varints