@Test
public void testCallService() {

	ServiceRequest req = new ServiceRequest("{\"test1\":\"test2\"}");
	DummyServiceCallback cb = new DummyServiceCallback();
	s1.callService(req, cb);
	while (DummyHandler.latest == null) {
		Thread.yield();
	}
	assertNotNull(DummyHandler.latest);
	assertEquals(5, DummyHandler.latest.size());
	assertEquals(JRosbridge.OP_CODE_CALL_SERVICE,
			DummyHandler.latest.getString(JRosbridge.FIELD_OP));
	assertEquals("call_service:myService:0",
			DummyHandler.latest.getString(JRosbridge.FIELD_ID));
	assertEquals("myType",
			DummyHandler.latest.getString(JRosbridge.FIELD_TYPE));
	assertEquals("myService",
			DummyHandler.latest.getString(JRosbridge.FIELD_SERVICE));
	assertEquals("{\"test1\":\"test2\"}", DummyHandler.latest
			.getJsonObject(JRosbridge.FIELD_ARGS).toString());
	JsonObject toSend = Json
			.createObjectBuilder()
			.add("echo",
					Json.createObjectBuilder()
							.add(JRosbridge.FIELD_OP,
									JRosbridge.OP_CODE_SERVICE_RESPONSE)
							.add(JRosbridge.FIELD_ID,
									"call_service:myService:0")
							.add(JRosbridge.FIELD_RESULT, false)
							.add(JRosbridge.FIELD_VALUES,
									Json.createObjectBuilder()
											.add("test3", "test4").build())
							.build().toString()).build();
	ros.send(toSend);
	while (cb.latest == null) {
		Thread.yield();
	}
	assertNotNull(cb.latest);
	assertEquals("{\"test3\":\"test4\"}", cb.latest.toString());
}