@Test public void testInit() throws Exception { final Rendezvous r = new RendezvousResponder(); final CountDownLatch wait = new CountDownLatch(1); final AssertionError[] failure = new AssertionError[1]; r.addListener(new RendezvousListener() { @Override public void serviceResolved(final String identifier, final Host host) { try { assertNotNull(host); } catch(AssertionError error) { failure[0] = error; } finally { wait.countDown(); } } @Override public void serviceLost(final Host servicename) { } }); r.init(); wait.await(5L, TimeUnit.SECONDS); if(failure[0] != null) { fail(failure[0].getMessage()); } r.quit(); }
@Override public void init() { if(log.isDebugEnabled()) { log.debug("Initialize responder by browsing DNSSD"); } super.init(); try { for(String protocol : this.getServiceTypes()) { if(log.isInfoEnabled()) { log.info(String.format("Adding service listener for %s", protocol)); } browsers.put(protocol, DNSSD.browse(protocol, this)); } } catch(DNSSDException e) { log.error(String.format("Failure initializing Bonjour discovery: %s", e.getMessage()), e); this.quit(); } }
RendezvousResponder extends AbstractRendezvous implements BrowseListener, ResolveListener { @Override public void init() { if(log.isDebugEnabled()) { log.debug("Initialize responder by browsing DNSSD"); } super.init(); try { for(String protocol : this.getServiceTypes()) { if(log.isInfoEnabled()) { log.info(String.format("Adding service listener for %s", protocol)); } browsers.put(protocol, DNSSD.browse(protocol, this)); } } catch(DNSSDException e) { log.error(String.format("Failure initializing Bonjour discovery: %s", e.getMessage()), e); this.quit(); } } }
RendezvousResponder extends AbstractRendezvous implements BrowseListener, ResolveListener { @Override public void init() { if(log.isDebugEnabled()) { log.debug("Initialize responder by browsing DNSSD"); } super.init(); try { for(String protocol : this.getServiceTypes()) { if(log.isInfoEnabled()) { log.info(String.format("Adding service listener for %s", protocol)); } browsers.put(protocol, DNSSD.browse(protocol, this)); } } catch(DNSSDException e) { log.error(String.format("Failure initializing Bonjour discovery: %s", e.getMessage()), e); this.quit(); } } RendezvousResponder();  RendezvousResponder(final ProtocolFactory protocols); }
RendezvousResponder extends AbstractRendezvous implements BrowseListener, ResolveListener { @Override public void init() { if(log.isDebugEnabled()) { log.debug("Initialize responder by browsing DNSSD"); } super.init(); try { for(String protocol : this.getServiceTypes()) { if(log.isInfoEnabled()) { log.info(String.format("Adding service listener for %s", protocol)); } browsers.put(protocol, DNSSD.browse(protocol, this)); } } catch(DNSSDException e) { log.error(String.format("Failure initializing Bonjour discovery: %s", e.getMessage()), e); this.quit(); } } RendezvousResponder();  RendezvousResponder(final ProtocolFactory protocols); @Override void init(); @Override void quit(); @Override void serviceFound(final DNSSDService browser, final int flags, final int ifIndex, final String serviceName,
                             final String regType, final String domain); @Override void serviceLost(final DNSSDService browser, final int flags, final int ifIndex, final String serviceName,
                            final String regType, final String domain); @Override void operationFailed(final DNSSDService resolver, final int errorCode); @Override void serviceResolved(final DNSSDService resolver, final int flags, final int ifIndex,
                                final String fullname, final String hostname, final int port, final TXTRecord txtRecord); }
RendezvousResponder extends AbstractRendezvous implements BrowseListener, ResolveListener { @Override public void init() { if(log.isDebugEnabled()) { log.debug("Initialize responder by browsing DNSSD"); } super.init(); try { for(String protocol : this.getServiceTypes()) { if(log.isInfoEnabled()) { log.info(String.format("Adding service listener for %s", protocol)); } browsers.put(protocol, DNSSD.browse(protocol, this)); } } catch(DNSSDException e) { log.error(String.format("Failure initializing Bonjour discovery: %s", e.getMessage()), e); this.quit(); } } RendezvousResponder();  RendezvousResponder(final ProtocolFactory protocols); @Override void init(); @Override void quit(); @Override void serviceFound(final DNSSDService browser, final int flags, final int ifIndex, final String serviceName,
                             final String regType, final String domain); @Override void serviceLost(final DNSSDService browser, final int flags, final int ifIndex, final String serviceName,
                            final String regType, final String domain); @Override void operationFailed(final DNSSDService resolver, final int errorCode); @Override void serviceResolved(final DNSSDService resolver, final int flags, final int ifIndex,
                                final String fullname, final String hostname, final int port, final TXTRecord txtRecord);  }