@Test
public void testSetupHttpClient() throws Exception {

    HttpCertSignerFactory certFactory = new HttpCertSignerFactory();
    HttpCertSigner certSigner = (HttpCertSigner) certFactory.create();
    HttpClient client = Mockito.mock(HttpClient.class);
    Mockito.doThrow(new Exception("Invalid client")).when(client).start();
    try {
        certSigner.setupHttpClient(client, 120, 120);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 500);
    }
}