List<Certificate> inputCerts = CryptoDataLoader.certificatesFromFile(new File(TEST_DATA_PATH));
HttpLogClient client = new HttpLogClient("");
JSONObject encoded = client.encodeCertificates(inputCerts);
Assert.assertTrue(encoded.containsKey("chain"));
JSONArray chain = (JSONArray) encoded.get("chain");
assertEquals("Expected to have two certificates in the chain", 2, chain.size());
// Make sure the order is reversed.
for (int i = 0; i < inputCerts.size(); i++) {
assertEquals(
Base64.encodeBase64String(inputCerts.get(i).getEncoded()),
chain.get(i));
}
}