adding support for length prefixed json on the client socket

As @portertech & I agreed on IRC, I am adding support for length prefixed JSON to the client socket while keeping the existing behavior as it is.

Thanks,
praddy
1. That's not off-by-one, and IMO things like these should be caught in the client lib's test suite as in this particular case client is totally misbehaving (not following the agreed upon protocol) by sending non-JSON data. And, further it's trying to send a length that would make it perfect JSON. All the server cares is whether the *length* you sent is a valid JSON or not and then validates the existence of mandatory keys in there, that's it. That said, I really don't care whether the extra bytes are removed or not. So, if folks feel that we should not remove the extra bytes then cool. I just don't think that "not removing extra bytes" would help in any way.

3. IMO, UDP (over loopback interface) is perfectly valid design feature as it allows the applications, raising exceptions for example, to just fire'n'forget. TCP guarantees data integrity anyway, so no need for additional checksum.