@Test
public void testUnsubscribe() {

	DummyTopicCallback cb = new DummyTopicCallback();
	t1.subscribe(cb);
	assertFalse(t1.isAdvertised());
	assertTrue(t1.isSubscribed());
	assertNull(cb.latest);
	t1.unsubscribe();
	ros.send(Json
			.createObjectBuilder()
			.add("echo",
					"{\"" + JRosbridge.FIELD_OP + "\":\""
							+ JRosbridge.OP_CODE_PUBLISH + "\",\""
							+ JRosbridge.FIELD_TOPIC + "\":\"myTopic1\",\""
							+ JRosbridge.FIELD_MESSAGE
							+ "\":{\"test1\":\"test2\"}}").build());
	Thread.yield();
	assertNotNull(DummyHandler.latest);
	assertEquals(
			"{\"op\":\"subscribe\",\"id\":\"subscribe:myTopic1:0\",\"type\":\"myType1\","
					+ "\"topic\":\"myTopic1\",\"compression\":\"none\",\"throttle_rate\":0}",
			DummyHandler.latest.toString());
	assertNull(cb.latest);
	assertFalse(t1.isAdvertised());
	assertFalse(t1.isSubscribed());
}