@Test public void remoteEncalveReturnsError() { when(enclave.defaultPublicKey()).thenThrow(new RuntimeException()); try { enclaveClient.defaultPublicKey(); failBecauseExceptionWasNotThrown(EnclaveException.class); } catch (EnclaveException ex) { verify(enclave).defaultPublicKey(); } }
@Override public PublicKey defaultPublicKey() { return ClientCallback.execute( () -> { Response response = client.target(uri).path("default").request().get(); validateResponseIsOk(response); byte[] data = response.readEntity(byte[].class); return PublicKey.from(data); }); }
RestfulEnclaveClient implements EnclaveClient { @Override public PublicKey defaultPublicKey() { return ClientCallback.execute( () -> { Response response = client.target(uri).path("default").request().get(); validateResponseIsOk(response); byte[] data = response.readEntity(byte[].class); return PublicKey.from(data); }); } }
RestfulEnclaveClient implements EnclaveClient { @Override public PublicKey defaultPublicKey() { return ClientCallback.execute( () -> { Response response = client.target(uri).path("default").request().get(); validateResponseIsOk(response); byte[] data = response.readEntity(byte[].class); return PublicKey.from(data); }); } RestfulEnclaveClient(Client client, URI uri);  RestfulEnclaveClient(Client client, URI uri, ExecutorService executorService); }
RestfulEnclaveClient implements EnclaveClient { @Override public PublicKey defaultPublicKey() { return ClientCallback.execute( () -> { Response response = client.target(uri).path("default").request().get(); validateResponseIsOk(response); byte[] data = response.readEntity(byte[].class); return PublicKey.from(data); }); } 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 PublicKey defaultPublicKey() { return ClientCallback.execute( () -> { Response response = client.target(uri).path("default").request().get(); validateResponseIsOk(response); byte[] data = response.readEntity(byte[].class); return PublicKey.from(data); }); } 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();  }