Skip to content

Commit b719d7e

Browse files
authored
Merge pull request eugenp#6839 from amit2103/BAEL-13600
Bael 13600
2 parents d699fa0 + e14aab2 commit b719d7e

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

httpclient-simple/src/test/java/org/baeldung/client/RestClientLiveManualTest.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,11 @@ public class RestClientLiveManualTest {
4646
// old httpClient will throw UnsupportedOperationException
4747
@Ignore
4848
@Test
49-
public final void givenAcceptingAllCertificates_whenHttpsUrlIsConsumed_thenException_1() throws GeneralSecurityException {
49+
public final void givenAcceptingAllCertificates_whenHttpsUrlIsConsumed_thenOk_1() throws GeneralSecurityException {
5050
final HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
5151
final CloseableHttpClient httpClient = (CloseableHttpClient) requestFactory.getHttpClient();
5252

53-
final TrustStrategy acceptingTrustStrategy = new TrustStrategy() {
54-
@Override
55-
public final boolean isTrusted(final X509Certificate[] certificate, final String authType) {
56-
return true;
57-
}
58-
};
53+
final TrustStrategy acceptingTrustStrategy = (cert, authType) -> true;
5954
final SSLSocketFactory sf = new SSLSocketFactory(acceptingTrustStrategy, ALLOW_ALL_HOSTNAME_VERIFIER);
6055
httpClient.getConnectionManager().getSchemeRegistry().register(new Scheme("https", 8443, sf));
6156

@@ -65,7 +60,7 @@ public final boolean isTrusted(final X509Certificate[] certificate, final String
6560

6661
// new httpClient : 4.4 and above
6762
@Test
68-
public final void givenAcceptingAllCertificates_whenHttpsUrlIsConsumed_thenException_2() throws GeneralSecurityException {
63+
public final void givenAcceptingAllCertificates_whenHttpsUrlIsConsumed_thenOk_2() throws GeneralSecurityException {
6964

7065
final TrustStrategy acceptingTrustStrategy = (cert, authType) -> true;
7166
final SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build();

0 commit comments

Comments
 (0)