ClientRegistryImpl implements ClientRegistry, Startable, Stoppable { @Override public boolean registerClient(Client client) { Validate.notNull(client); LOG.debug("Registering new client: {}", client); Client previous = clientsByEp.put(client.getEndpoint(), client); if (previous != null) { for (ClientRegistryListener l : listeners) { l.unregistered(previous); } } for (ClientRegistryListener l : listeners) { l.registered(client); } return true; }  @Override void addListener(ClientRegistryListener listener); @Override void removeListener(ClientRegistryListener listener); @Override Collection<Client> allClients(); @Override Client get(String endpoint); @Override boolean registerClient(Client client); @Override Client updateClient(ClientUpdate update); @Override Client deregisterClient(String registrationId); @Override Client findByRegistrationId(String id); @Override void start(); @Override void stop();  }
@Test public void client_registration_sets_time_to_live() { givenASimpleClient(lifetime); registry.registerClient(client); Assert.assertTrue(client.isAlive()); }