### Question:
Ros { public void deregisterTopicCallback(String topic, TopicCallback cb) { if (this.topicCallbacks.containsKey(topic)) { ArrayList<TopicCallback> callbacks = this.topicCallbacks.get(topic); if (callbacks.contains(cb)) { callbacks.remove(cb); } if (callbacks.size() == 0) { this.topicCallbacks.remove(topic); } } } Ros();  Ros(String hostname);  Ros(String hostname, int port);  Ros(String hostname, int port, JRosbridge.WebSocketType protocol); String getHostname(); int getPort(); JRosbridge.WebSocketType getProtocol(); String getURL(); long nextId(); void addRosHandler(RosHandler handler); boolean connect(); boolean disconnect(); boolean isConnected(); @OnOpen void onOpen(Session session); @OnClose void onClose(Session session); @OnError void onError(Session session, Throwable t); @OnMessage void onMessage(String message); boolean send(JsonObject jsonObject); void authenticate(String mac, String client, String dest,
			String rand, int t, String level, int end); void registerTopicCallback(String topic, TopicCallback cb); void deregisterTopicCallback(String topic, TopicCallback cb); void registerServiceCallback(String serviceCallId, ServiceCallback cb); void registerCallServiceCallback(String serviceName, CallServiceCallback cb); void deregisterCallServiceCallback(String serviceName); static final String DEFAULT_HOSTNAME; static final int DEFAULT_PORT; }### Answer:
@Test public void testDeregisterTopicCallback() { assertTrue(r1.connect()); DummyTopicCallback cb1 = new DummyTopicCallback(); DummyTopicCallback cb2 = new DummyTopicCallback(); r1.registerTopicCallback("myTopic", cb1); r1.registerTopicCallback("myTopic", cb2); assertNull(cb1.latest); assertNull(cb2.latest); r1.deregisterTopicCallback("myTopic", cb1); r1.onMessage("{\"" + JRosbridge.FIELD_OP + "\":\"" + JRosbridge.OP_CODE_PUBLISH + "\",\"" + JRosbridge.FIELD_TOPIC + "\":\"myTopic\",\"" + JRosbridge.FIELD_MESSAGE + "\":{\"test1\":\"test2\"}}"); Thread.yield(); assertNull(DummyHandler.latest); assertNull(cb1.latest); assertNotNull(cb2.latest); assertEquals("{\"test1\":\"test2\"}", cb2.latest.toString()); }