public void test() throws IOException, CertificateException, NoSuchAlgorithmException {
Client user = Client.builder().certificate(certificate).orgname("jclouds").clientname("adriancole-jcloudstest")
.name("adriancole-jcloudstest").isValidator(false).privateKey(privateKey).build();
byte[] encrypted = ByteStreams.toByteArray(new RSAEncryptingPayload(new JCECrypto(), Payloads.newPayload("fooya"), user
.getCertificate().getPublicKey()));
assertEquals(
ByteStreams.toByteArray(new RSADecryptingPayload(new JCECrypto(), Payloads.newPayload(encrypted), user.getPrivateKey())),
"fooya".getBytes());
assertEquals(
handler.apply(HttpResponse.builder().statusCode(200).message("ok")
.payload(ParseClientFromJsonTest.class.getResourceAsStream("/client.json")).build()), user);