@Test public void testStartStop() throws Exception { StandardDirectoryAgentServer da = StandardDirectoryAgentServer.newInstance(newSettings()); assert !da.isRunning(); da.start(); assert da.isRunning(); da.stop(); assert !da.isRunning(); }
public static StandardDirectoryAgentServer newInstance(Settings settings) { UDPConnector udpConnector = Factories.<UDPConnector.Factory>newInstance(settings, UDP_CONNECTOR_FACTORY_KEY).newUDPConnector(settings); TCPConnector tcpConnector = Factories.<TCPConnector.Factory>newInstance(settings, TCP_CONNECTOR_FACTORY_KEY).newTCPConnector(settings); UDPConnectorServer udpConnectorServer = Factories.<UDPConnectorServer.Factory>newInstance(settings, UDP_CONNECTOR_SERVER_FACTORY_KEY).newUDPConnectorServer(settings); TCPConnectorServer tcpConnectorServer = Factories.<TCPConnectorServer.Factory>newInstance(settings, TCP_CONNECTOR_SERVER_FACTORY_KEY).newTCPConnectorServer(settings); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); return new StandardDirectoryAgentServer(udpConnector, tcpConnector, udpConnectorServer, tcpConnectorServer, scheduledExecutorService, settings); }
StandardDirectoryAgentServer extends AbstractServer { public static StandardDirectoryAgentServer newInstance(Settings settings) { UDPConnector udpConnector = Factories.<UDPConnector.Factory>newInstance(settings, UDP_CONNECTOR_FACTORY_KEY).newUDPConnector(settings); TCPConnector tcpConnector = Factories.<TCPConnector.Factory>newInstance(settings, TCP_CONNECTOR_FACTORY_KEY).newTCPConnector(settings); UDPConnectorServer udpConnectorServer = Factories.<UDPConnectorServer.Factory>newInstance(settings, UDP_CONNECTOR_SERVER_FACTORY_KEY).newUDPConnectorServer(settings); TCPConnectorServer tcpConnectorServer = Factories.<TCPConnectorServer.Factory>newInstance(settings, TCP_CONNECTOR_SERVER_FACTORY_KEY).newTCPConnectorServer(settings); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); return new StandardDirectoryAgentServer(udpConnector, tcpConnector, udpConnectorServer, tcpConnectorServer, scheduledExecutorService, settings); } }
StandardDirectoryAgentServer extends AbstractServer { public static StandardDirectoryAgentServer newInstance(Settings settings) { UDPConnector udpConnector = Factories.<UDPConnector.Factory>newInstance(settings, UDP_CONNECTOR_FACTORY_KEY).newUDPConnector(settings); TCPConnector tcpConnector = Factories.<TCPConnector.Factory>newInstance(settings, TCP_CONNECTOR_FACTORY_KEY).newTCPConnector(settings); UDPConnectorServer udpConnectorServer = Factories.<UDPConnectorServer.Factory>newInstance(settings, UDP_CONNECTOR_SERVER_FACTORY_KEY).newUDPConnectorServer(settings); TCPConnectorServer tcpConnectorServer = Factories.<TCPConnectorServer.Factory>newInstance(settings, TCP_CONNECTOR_SERVER_FACTORY_KEY).newTCPConnectorServer(settings); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); return new StandardDirectoryAgentServer(udpConnector, tcpConnector, udpConnectorServer, tcpConnectorServer, scheduledExecutorService, settings); } StandardDirectoryAgentServer(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, TCPConnectorServer tcpConnectorServer, ScheduledExecutorService scheduledExecutorService);  StandardDirectoryAgentServer(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, TCPConnectorServer tcpConnectorServer, ScheduledExecutorService scheduledExecutorService, Settings settings); }
StandardDirectoryAgentServer extends AbstractServer { public static StandardDirectoryAgentServer newInstance(Settings settings) { UDPConnector udpConnector = Factories.<UDPConnector.Factory>newInstance(settings, UDP_CONNECTOR_FACTORY_KEY).newUDPConnector(settings); TCPConnector tcpConnector = Factories.<TCPConnector.Factory>newInstance(settings, TCP_CONNECTOR_FACTORY_KEY).newTCPConnector(settings); UDPConnectorServer udpConnectorServer = Factories.<UDPConnectorServer.Factory>newInstance(settings, UDP_CONNECTOR_SERVER_FACTORY_KEY).newUDPConnectorServer(settings); TCPConnectorServer tcpConnectorServer = Factories.<TCPConnectorServer.Factory>newInstance(settings, TCP_CONNECTOR_SERVER_FACTORY_KEY).newTCPConnectorServer(settings); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); return new StandardDirectoryAgentServer(udpConnector, tcpConnector, udpConnectorServer, tcpConnectorServer, scheduledExecutorService, settings); } StandardDirectoryAgentServer(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, TCPConnectorServer tcpConnectorServer, ScheduledExecutorService scheduledExecutorService);  StandardDirectoryAgentServer(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, TCPConnectorServer tcpConnectorServer, ScheduledExecutorService scheduledExecutorService, Settings settings); static void main(String[] args); static StandardDirectoryAgentServer newInstance(Settings settings); String[] getAddresses(); void setAddresses(String[] addresses); int getPort(); void setPort(int port); Scopes getScopes(); void setScopes(Scopes scopes); Attributes getAttributes(); void setAttributes(Attributes attributes); String getLanguage(); void setLanguage(String language); int getAdvertisementPeriod(); void setAdvertisementPeriod(int advertisementPeriod); int getExpiredServicesPurgePeriod(); void setExpiredServicesPurgePeriod(int expiredServicesPurgePeriod); void addServiceListener(ServiceListener listener); void removeServiceListener(ServiceListener listener); List<ServiceInfo> getServices(); }
StandardDirectoryAgentServer extends AbstractServer { public static StandardDirectoryAgentServer newInstance(Settings settings) { UDPConnector udpConnector = Factories.<UDPConnector.Factory>newInstance(settings, UDP_CONNECTOR_FACTORY_KEY).newUDPConnector(settings); TCPConnector tcpConnector = Factories.<TCPConnector.Factory>newInstance(settings, TCP_CONNECTOR_FACTORY_KEY).newTCPConnector(settings); UDPConnectorServer udpConnectorServer = Factories.<UDPConnectorServer.Factory>newInstance(settings, UDP_CONNECTOR_SERVER_FACTORY_KEY).newUDPConnectorServer(settings); TCPConnectorServer tcpConnectorServer = Factories.<TCPConnectorServer.Factory>newInstance(settings, TCP_CONNECTOR_SERVER_FACTORY_KEY).newTCPConnectorServer(settings); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); return new StandardDirectoryAgentServer(udpConnector, tcpConnector, udpConnectorServer, tcpConnectorServer, scheduledExecutorService, settings); } StandardDirectoryAgentServer(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, TCPConnectorServer tcpConnectorServer, ScheduledExecutorService scheduledExecutorService);  StandardDirectoryAgentServer(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, TCPConnectorServer tcpConnectorServer, ScheduledExecutorService scheduledExecutorService, Settings settings); static void main(String[] args); static StandardDirectoryAgentServer newInstance(Settings settings); String[] getAddresses(); void setAddresses(String[] addresses); int getPort(); void setPort(int port); Scopes getScopes(); void setScopes(Scopes scopes); Attributes getAttributes(); void setAttributes(Attributes attributes); String getLanguage(); void setLanguage(String language); int getAdvertisementPeriod(); void setAdvertisementPeriod(int advertisementPeriod); int getExpiredServicesPurgePeriod(); void setExpiredServicesPurgePeriod(int expiredServicesPurgePeriod); void addServiceListener(ServiceListener listener); void removeServiceListener(ServiceListener listener); List<ServiceInfo> getServices();  }