UaaHttpRequestUtils { public static ClientHttpRequestFactory createRequestFactory(boolean skipSslValidation, int timeout) { return createRequestFactory(getClientBuilder(skipSslValidation), timeout); }  static ClientHttpRequestFactory createRequestFactory(boolean skipSslValidation, int timeout); static String paramsToQueryString(Map<String, String[]> parameterMap); static boolean isAcceptedInvitationAuthentication();  }
@Test public void skipSslValidation() { RestTemplate restTemplate = new RestTemplate(createRequestFactory(true, 10_000)); assertEquals(OK, restTemplate.getForEntity(httpsUrl, String.class).getStatusCode()); }
@Test public void trustedOnly() { RestTemplate restTemplate = new RestTemplate(UaaHttpRequestUtils.createRequestFactory(false, 10_000)); try { restTemplate.getForEntity(httpsUrl, String.class); fail("We should not reach this step if the above URL is using a self signed certificate"); } catch (RestClientException e) { assertEquals(SSLHandshakeException.class, e.getCause().getClass()); } }