### Question:
EtcdServiceRegistry implements ServiceRegistry<EtcdRegistration> { @Override public void register(EtcdRegistration registration) { String etcdKey = registration.etcdKey(properties.getPrefix()); try { long leaseId = lease.getLeaseId(); PutOption putOption = PutOption.newBuilder() .withLeaseId(leaseId) .build(); etcdClient.getKVClient() .put(fromString(etcdKey), fromString(objectMapper.writeValueAsString(registration)), putOption) .get(); } catch (JsonProcessingException | InterruptedException | ExecutionException e) { throw new EtcdOperationException(e); } }  @Override void register(EtcdRegistration registration); @Override void deregister(EtcdRegistration registration); @Override void close(); @Override void setStatus(EtcdRegistration registration, String status); @Override Object getStatus(EtcdRegistration registration);  }### Answer:
@Test public void testRegister() throws ExecutionException, InterruptedException, JsonProcessingException { Client client = Client.builder() .endpoints(container.clientEndpoint()) .build(); HeartbeatProperties heartbeatProperties = new HeartbeatProperties(); heartbeatProperties.setInterval(5); EtcdHeartbeatLease heartbeatLease = new EtcdHeartbeatLease(client, heartbeatProperties); EtcdDiscoveryProperties discoveryProperties = new EtcdDiscoveryProperties(); EtcdServiceRegistry registry = new EtcdServiceRegistry(client, discoveryProperties, heartbeatLease); EtcdRegistration registration = new EtcdRegistration( "test-app", "127.0.0.1", 8080 ); String key = registration.etcdKey(discoveryProperties.getPrefix()); registry.register(registration); Long leaseId = heartbeatLease.getLeaseId(); assertNotNull(leaseId); LeaseTimeToLiveResponse leaseTimeToLiveResponse = client.getLeaseClient().timeToLive(leaseId, LeaseOption.newBuilder().withAttachedKeys().build()).get(); Thread.sleep(10); assertEquals(leaseTimeToLiveResponse.getGrantedTTL(), heartbeatProperties.getInterval()); assertTrue(leaseTimeToLiveResponse.getTTl() > 0); assertTrue(leaseTimeToLiveResponse.getTTl() < heartbeatProperties.getInterval()); List<ByteSequence> keys = leaseTimeToLiveResponse.getKeys(); assertEquals(keys.size(), 1); assertEquals(keys.get(0).toStringUtf8(), key); GetResponse getResponse = client.getKVClient().get(fromString(key)).get(); assertEquals(getResponse.getCount(), 1); assertEquals(getResponse.getKvs().get(0).getValue().toStringUtf8(), objectMapper.writeValueAsString(registration)); }