| 16 | using namespace std; |
| 17 | |
| 18 | int main() { |
| 19 | HttpClient httpclient("http://localhost:8383"); |
| 20 | // StubClient c(httpclient, JSONRPC_CLIENT_V1); //json-rpc 1.0 |
| 21 | StubClient c(httpclient, JSONRPC_CLIENT_V2); // json-rpc 2.0 |
| 22 | |
| 23 | try { |
| 24 | cout << c.sayHello("Peter Knafl") << endl; |
| 25 | c.notifyServer(); |
| 26 | |
| 27 | cout << " 3 + 5 = " << c.addNumbers(3, 5) << endl; |
| 28 | cout << " 3.2 + 5.3 = " << c.addNumbers2(3.2, 5.3) << endl; |
| 29 | Json::Value args; |
| 30 | args["arg1"] = 1; |
| 31 | args["arg2"] = 2; |
| 32 | args["operator"] = "+"; |
| 33 | Json::Value result = c.calculate(args); |
| 34 | cout << " 1 + 2 = " << result[0].asInt() << endl; |
| 35 | args["arg1"] = 3; |
| 36 | args["arg2"] = 4; |
| 37 | args["operator"] = "*"; |
| 38 | result = c.calculate(args); |
| 39 | cout << " 3 * 4 = " << result[0].asInt() << endl; |
| 40 | cout << "Compare: " << c.isEqual("Peter", "peter") << endl; |
| 41 | cout << "Build object: " << c.buildObject("Peter", 1990) << endl; |
| 42 | |
| 43 | c.sayHello(""); // expects a server error |
| 44 | |
| 45 | } catch (JsonRpcException &e) { |
| 46 | cerr << e.what() << endl; |
| 47 | } |
| 48 | } |
nothing calls this directly
no test coverage detected