@Test
public void testAdvertiseService() {

	DummyCallServiceCallback cb = new DummyCallServiceCallback();
	s1.advertiseService(cb);
	assertNull(cb.latest);
	while (DummyHandler.latest == null) {
		Thread.yield();
	}
	assertNotNull(DummyHandler.latest);
	assertEquals(
			"{\"op\":\"advertise_service\",\"type\":\"myType\"," + "\"service\":\"myService\"}",
			DummyHandler.latest.toString());
	assertTrue(s1.isAdvertised());
	ros.send(Json
			.createObjectBuilder()
			.add("echo",
					"{\"" + JRosbridge.FIELD_OP + "\":\""
							+ JRosbridge.OP_CODE_CALL_SERVICE + "\",\""
							+ JRosbridge.FIELD_ID + "\":\"myServiceId\",\""
							+ JRosbridge.FIELD_SERVICE + "\":\"myService\",\""
							+ JRosbridge.FIELD_ARGS
							+ "\":{\"test1\":\"test2\"}}").build());
	while (cb.latest == null) {
		Thread.yield();
	}
	assertNotNull(cb.latest);
	assertEquals("{\"test1\":\"test2\"}", cb.latest.toString());
	assertEquals("myServiceId", cb.latest.getId());
}