25
25
import java .net .InetSocketAddress ;
26
26
import java .net .MalformedURLException ;
27
27
import java .net .ServerSocket ;
28
- import java .net .Socket ;
29
28
import java .net .URI ;
30
29
import java .net .URISyntaxException ;
31
30
import java .net .URL ;
75
74
import org .apache .http .impl .client .HttpClientBuilder ;
76
75
import org .apache .http .impl .client .HttpClients ;
77
76
import org .apache .http .protocol .HttpContext ;
78
- import org .apache .http .ssl .PrivateKeyDetails ;
79
- import org .apache .http .ssl .PrivateKeyStrategy ;
80
77
import org .apache .http .ssl .SSLContextBuilder ;
81
78
import org .apache .http .ssl .TrustStrategy ;
82
79
import org .apache .jasper .EmbeddedServletOptions ;
@@ -503,16 +500,7 @@ public void pkcs12KeyStoreAndTrustStore() throws Exception {
503
500
new SSLContextBuilder ()
504
501
.loadTrustMaterial (null , new TrustSelfSignedStrategy ())
505
502
.loadKeyMaterial (keyStore , "secret" .toCharArray (),
506
- new PrivateKeyStrategy () {
507
-
508
- @ Override
509
- public String chooseAlias (
510
- Map <String , PrivateKeyDetails > aliases ,
511
- Socket socket ) {
512
- return "spring-boot" ;
513
- }
514
-
515
- })
503
+ (aliases , socket ) -> "spring-boot" )
516
504
.build ());
517
505
HttpClient httpClient = HttpClients .custom ().setSSLSocketFactory (socketFactory )
518
506
.build ();
@@ -538,15 +526,7 @@ public void sslNeedsClientAuthenticationSucceedsWithClientCertificate()
538
526
new SSLContextBuilder ()
539
527
.loadTrustMaterial (null , new TrustSelfSignedStrategy ())
540
528
.loadKeyMaterial (keyStore , "password" .toCharArray (),
541
- new PrivateKeyStrategy () {
542
-
543
- @ Override
544
- public String chooseAlias (
545
- Map <String , PrivateKeyDetails > aliases ,
546
- Socket socket ) {
547
- return "spring-boot" ;
548
- }
549
- })
529
+ (aliases , socket ) -> "spring-boot" )
550
530
.build ());
551
531
HttpClient httpClient = HttpClients .custom ().setSSLSocketFactory (socketFactory )
552
532
.build ();
@@ -639,15 +619,7 @@ public void sslWithCustomSslStoreProvider() throws Exception {
639
619
new SSLContextBuilder ()
640
620
.loadTrustMaterial (null , new TrustSelfSignedStrategy ())
641
621
.loadKeyMaterial (keyStore , "password" .toCharArray (),
642
- new PrivateKeyStrategy () {
643
-
644
- @ Override
645
- public String chooseAlias (
646
- Map <String , PrivateKeyDetails > aliases ,
647
- Socket socket ) {
648
- return "spring-boot" ;
649
- }
650
- })
622
+ (aliases , socket ) -> "spring-boot" )
651
623
.build ());
652
624
HttpClient httpClient = HttpClients .custom ().setSSLSocketFactory (socketFactory )
653
625
.build ();
0 commit comments