StreamDiscoverer implements Closeable { @Override public void close() { streams.removeListener(listenerHandle); urls.setValue(emptyStringArray); } StreamDiscoverer(NetworkTable publisherTable, String cameraName); String[] getUrls(); ReadOnlyProperty<String[]> urlsProperty(); @Override void close();  }
@Test public void testClose() { final StreamDiscoverer discoverer = new StreamDiscoverer(rootTable, "Camera"); String[] urls = {"foo", "bar"}; rootTable.getEntry("Camera/streams").setStringArray(urls); waitForNtEvents(); discoverer.close(); rootTable.getEntry("Camera/streams").setStringArray(new String[]{"bar", "foo"}); waitForNtEvents(); assertArrayEquals(new String[0], discoverer.getUrls()); }