@@ -179,7 +179,6 @@ public static void testSetupSocketFactory() throws NoSuchProviderException,
179179 try {
180180 tf = new WolfSSLTestFactory ();
181181 } catch (WolfSSLException e ) {
182- // TODO Auto-generated catch block
183182 e .printStackTrace ();
184183 }
185184
@@ -659,7 +658,7 @@ public void testEnabledSupportedCurvesProperty() throws Exception {
659658
660659 try {
661660 client .join (1000 );
662- // server.join(1000);
661+ /* server.join(1000); */
663662
664663 } catch (InterruptedException e ) {
665664 System .out .println ("interrupt happened" );
@@ -1034,8 +1033,9 @@ public void testExtendedThreadingUse()
10341033
10351034 System .out .print ("\t Testing ExtendedThreadingUse" );
10361035
1037- /* This test hangs on Android, marking TODO for later investigation. Seems to be
1038- * something specific to the test code, not library proper. */
1036+ /* This test hangs on Android, marking TODO for later investigation.
1037+ * Seems to be something specific to the test code, not library
1038+ * proper. */
10391039 if (WolfSSLTestFactory .isAndroid ()) {
10401040 System .out .println ("\t ... skipped" );
10411041 return ;
@@ -1044,7 +1044,8 @@ public void testExtendedThreadingUse()
10441044 /* Start up simple TLS test server */
10451045 CountDownLatch serverOpenLatch = new CountDownLatch (1 );
10461046 InternalMultiThreadedSSLSocketServer server =
1047- new InternalMultiThreadedSSLSocketServer (svrPort , serverOpenLatch , numThreads );
1047+ new InternalMultiThreadedSSLSocketServer (svrPort , serverOpenLatch ,
1048+ numThreads );
10481049 server .start ();
10491050
10501051 /* Wait for server thread to start up before connecting clients */
@@ -3402,16 +3403,30 @@ public void testAutoSNIProperty() throws Exception {
34023403 public void testSNIMatchers () throws Exception {
34033404
34043405 System .out .print ("\t Testing SNI Matchers" );
3405-
3406+
3407+ /* SNI matcher functionality requires wolfSSL 5.7.2 or later.
3408+ * Older versions have a limitation where wolfSSL_SNI_GetRequest()
3409+ * only returns SNI data if native wolfSSL already matched it, but
3410+ * wolfJSSE relies on retrieving the SNI to do matching at the Java
3411+ * level. This was fixed in wolfSSL 5.7.2 by adding an ignoreStatus
3412+ * parameter to TLSX_SNI_GetRequest(). */
3413+ long libVerHex = WolfSSL .getLibVersionHex ();
3414+ if (libVerHex < 0x05007002L ) {
3415+ System .out .println ("\t \t ... skipped" );
3416+ return ;
3417+ }
3418+
34063419 /* create new CTX */
34073420 this .ctx = tf .createSSLContext ("TLS" , ctxProvider );
3408-
3421+
34093422 /* create SSLServerSocket first to get ephemeral port */
3410- final SSLServerSocket ss = (SSLServerSocket )ctx .getServerSocketFactory ()
3411- .createServerSocket (0 );
3412-
3423+ final SSLServerSocket ss =
3424+ (SSLServerSocket )ctx .getServerSocketFactory ()
3425+ .createServerSocket (0 );
3426+
34133427 /* Configure SNI matcher for server*/
3414- SNIMatcher matcher = SNIHostName .createSNIMatcher ("www\\ .example\\ .com" );
3428+ SNIMatcher matcher =
3429+ SNIHostName .createSNIMatcher ("www\\ .example\\ .com" );
34153430 Collection <SNIMatcher > matchers = new ArrayList <>();
34163431 matchers .add (matcher );
34173432 SSLParameters sp = ss .getSSLParameters ();
@@ -3436,7 +3451,7 @@ public void testSNIMatchers() throws Exception {
34363451 cs .setSSLParameters (cp );
34373452
34383453 final SSLSocket serverMatched = (SSLSocket )ss .accept ();
3439-
3454+
34403455 ExecutorService es = Executors .newSingleThreadExecutor ();
34413456 Future <Void > serverFuture = es .submit (new Callable <Void >() {
34423457 @ Override
@@ -3451,10 +3466,10 @@ public Void call() throws Exception {
34513466 return null ;
34523467 }
34533468 });
3454-
3469+
34553470 cs .startHandshake ();
34563471 cs .close ();
3457-
3472+
34583473 es .shutdown ();
34593474 serverFuture .get ();
34603475
@@ -3473,7 +3488,7 @@ public Void call() throws Exception {
34733488 cs .setSSLParameters (cp );
34743489
34753490 final SSLSocket serverUnmatched = (SSLSocket )ss .accept ();
3476-
3491+
34773492 es = Executors .newSingleThreadExecutor ();
34783493 serverFuture = es .submit (() -> {
34793494 try {
@@ -3499,7 +3514,8 @@ public Void call() throws Exception {
34993514 System .out .println ("\t \t ... passed" );
35003515 } catch (Exception e ) {
35013516 System .out .println ("\t \t ... failed" );
3502- fail ();
3517+ e .printStackTrace ();
3518+ fail ("SNI Matcher test failed: " + e .getMessage ());
35033519 } finally {
35043520 ss .close ();
35053521 }
0 commit comments