@Test public void statusStarted() { when(enclave.status()).thenReturn(Service.Status.STARTED); assertThat(enclaveClient.status()).isEqualTo(Service.Status.STARTED); verify(enclave).status(); }
@Override public Service.Status status() { Future<Service.Status> outcome = executorService.submit( () -> { Response response = client.target(uri).path("ping").request().get(); if (response.getStatus() == 200) { return Service.Status.STARTED; } return Service.Status.STOPPED; }); try { return outcome.get(2, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException ex) { LOGGER.trace(null, ex); return Service.Status.STOPPED; } }
RestfulEnclaveClient implements EnclaveClient { @Override public Service.Status status() { Future<Service.Status> outcome = executorService.submit( () -> { Response response = client.target(uri).path("ping").request().get(); if (response.getStatus() == 200) { return Service.Status.STARTED; } return Service.Status.STOPPED; }); try { return outcome.get(2, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException ex) { LOGGER.trace(null, ex); return Service.Status.STOPPED; } } }
RestfulEnclaveClient implements EnclaveClient { @Override public Service.Status status() { Future<Service.Status> outcome = executorService.submit( () -> { Response response = client.target(uri).path("ping").request().get(); if (response.getStatus() == 200) { return Service.Status.STARTED; } return Service.Status.STOPPED; }); try { return outcome.get(2, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException ex) { LOGGER.trace(null, ex); return Service.Status.STOPPED; } } RestfulEnclaveClient(Client client, URI uri);  RestfulEnclaveClient(Client client, URI uri, ExecutorService executorService); }
RestfulEnclaveClient implements EnclaveClient { @Override public Service.Status status() { Future<Service.Status> outcome = executorService.submit( () -> { Response response = client.target(uri).path("ping").request().get(); if (response.getStatus() == 200) { return Service.Status.STARTED; } return Service.Status.STOPPED; }); try { return outcome.get(2, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException ex) { LOGGER.trace(null, ex); return Service.Status.STOPPED; } } RestfulEnclaveClient(Client client, URI uri);  RestfulEnclaveClient(Client client, URI uri, ExecutorService executorService); @Override PublicKey defaultPublicKey(); @Override Set<PublicKey> getForwardingKeys(); @Override Set<PublicKey> getPublicKeys(); @Override EncodedPayload encryptPayload(
            byte[] message, PublicKey senderPublicKey, List<PublicKey> recipientPublicKeys); @Override EncodedPayload encryptPayload(RawTransaction rawTransaction, List<PublicKey> recipientPublicKeys); @Override RawTransaction encryptRawPayload(byte[] message, PublicKey sender); @Override byte[] unencryptTransaction(EncodedPayload payload, PublicKey providedKey); @Override byte[] createNewRecipientBox(final EncodedPayload payload, final PublicKey recipientKey); @Override Service.Status status(); }
RestfulEnclaveClient implements EnclaveClient { @Override public Service.Status status() { Future<Service.Status> outcome = executorService.submit( () -> { Response response = client.target(uri).path("ping").request().get(); if (response.getStatus() == 200) { return Service.Status.STARTED; } return Service.Status.STOPPED; }); try { return outcome.get(2, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException ex) { LOGGER.trace(null, ex); return Service.Status.STOPPED; } } RestfulEnclaveClient(Client client, URI uri);  RestfulEnclaveClient(Client client, URI uri, ExecutorService executorService); @Override PublicKey defaultPublicKey(); @Override Set<PublicKey> getForwardingKeys(); @Override Set<PublicKey> getPublicKeys(); @Override EncodedPayload encryptPayload(
            byte[] message, PublicKey senderPublicKey, List<PublicKey> recipientPublicKeys); @Override EncodedPayload encryptPayload(RawTransaction rawTransaction, List<PublicKey> recipientPublicKeys); @Override RawTransaction encryptRawPayload(byte[] message, PublicKey sender); @Override byte[] unencryptTransaction(EncodedPayload payload, PublicKey providedKey); @Override byte[] createNewRecipientBox(final EncodedPayload payload, final PublicKey recipientKey); @Override Service.Status status();  }