refactored jsonrpcstub for better testing
refactored for 100% coverage :)