modify from https://code.google.com/p/json-rpc-for-java/