@@ -268,6 +268,7 @@ public void test_WolfSSLSession_setPskClientCb() {
268268 if (!e .getMessage ().equals ("wolfSSL not compiled with PSK " +
269269 "support" )) {
270270 System .out .println ("\t \t ... failed" );
271+ fail ("Failed setPskClientCb test" );
271272 e .printStackTrace ();
272273 }
273274 }
@@ -303,6 +304,7 @@ public void test_WolfSSLSession_setPskServerCb() {
303304 if (!e .getMessage ().equals ("wolfSSL not compiled with PSK " +
304305 "support" )) {
305306 System .out .println ("\t \t ... failed" );
307+ fail ("Failed setPskServerCb test" );
306308 e .printStackTrace ();
307309 }
308310 }
@@ -320,6 +322,7 @@ public void test_WolfSSLSession_usePskIdentityHint() {
320322 }
321323 } catch (IllegalStateException e ) {
322324 System .out .println ("\t \t ... failed" );
325+ fail ("Failed usePskIdentityHint test" );
323326 e .printStackTrace ();
324327 }
325328 System .out .println ("\t \t ... passed" );
@@ -335,6 +338,7 @@ public void test_WolfSSLSession_getPskIdentityHint() {
335338 }
336339 } catch (IllegalStateException e ) {
337340 System .out .println ("\t \t ... failed" );
341+ fail ("Failed getPskIdentityHint test" );
338342 e .printStackTrace ();
339343 }
340344 System .out .println ("\t \t ... passed" );
@@ -362,6 +366,7 @@ public void test_WolfSSLSession_getPskIdentity() {
362366 String identity = ssl .getPskIdentity ();
363367 } catch (IllegalStateException e ) {
364368 System .out .println ("\t \t ... failed" );
369+ fail ("Failed getPskIdentity test" );
365370 e .printStackTrace ();
366371 }
367372 System .out .println ("\t \t ... passed" );
@@ -373,6 +378,7 @@ public void test_WolfSSLSession_timeout() {
373378 ssl .setTimeout (5 );
374379 if (ssl .getTimeout () != 5 ) {
375380 System .out .println ("\t \t \t ... failed" );
381+ fail ("Failed timeout test" );
376382 }
377383 System .out .println ("\t \t \t ... passed" );
378384 }
@@ -382,6 +388,7 @@ public void test_WolfSSLSession_status() {
382388 System .out .print ("\t status()" );
383389 if (ssl .handshakeDone () == true ) {
384390 System .out .println ("\t \t \t ... failed" );
391+ fail ("Failed status test" );
385392 }
386393 System .out .println ("\t \t \t ... passed" );
387394 }
@@ -397,6 +404,7 @@ public void test_WolfSSLSession_useSNI() {
397404 System .out .println ("\t \t \t ... skipped" );
398405 } else if (ret != WolfSSL .SSL_SUCCESS ) {
399406 System .out .println ("\t \t \t ... failed" );
407+ fail ("Failed useSNI test" );
400408 } else {
401409 System .out .println ("\t \t \t ... passed" );
402410 }
@@ -408,7 +416,9 @@ public void test_WolfSSLSession_useALPN() {
408416 String [] alpnProtos = new String [] {
409417 "h2" , "http/1.1"
410418 };
411- byte [] alpnProtoBytes = "http/1.1" .getBytes ();
419+ String http11Alpn = "http/1.1" ;
420+ byte [] alpnProtoBytes = http11Alpn .getBytes ();
421+ byte [] alpnProtoBytesPacked = new byte [1 + alpnProtoBytes .length ];
412422
413423 System .out .print ("\t useALPN()" );
414424
@@ -447,7 +457,12 @@ public void test_WolfSSLSession_useALPN() {
447457
448458 /* Testing useALPN(byte[]) */
449459 if (ret == WolfSSL .SSL_SUCCESS ) {
450- ret = ssl .useALPN (alpnProtoBytes );
460+
461+ alpnProtoBytesPacked [0 ] = (byte )http11Alpn .length ();
462+ System .arraycopy (alpnProtoBytes , 0 , alpnProtoBytesPacked , 1 ,
463+ alpnProtoBytes .length );
464+
465+ ret = ssl .useALPN (alpnProtoBytesPacked );
451466 }
452467
453468 if (ret == WolfSSL .SSL_SUCCESS ) {
@@ -462,6 +477,7 @@ public void test_WolfSSLSession_useALPN() {
462477 System .out .println ("\t \t \t ... skipped" );
463478 } else if (ret != WolfSSL .SSL_SUCCESS ) {
464479 System .out .println ("\t \t \t ... failed" );
480+ fail ("Failed useALPN test" );
465481 } else {
466482 System .out .println ("\t \t \t ... passed" );
467483 }
@@ -475,6 +491,7 @@ public void test_WolfSSLSession_freeSSL() {
475491 ssl .freeSSL ();
476492 } catch (WolfSSLJNIException e ) {
477493 System .out .println ("\t \t \t ... failed" );
494+ fail ("Failed freeSSL test" );
478495 e .printStackTrace ();
479496 }
480497 System .out .println ("\t \t \t ... passed" );
@@ -530,6 +547,7 @@ public void test_WolfSSLSession_UseAfterFree() {
530547
531548 } catch (Exception e ) {
532549 System .out .println ("\t \t ... failed" );
550+ fail ("Failed UseAfterFree test" );
533551 e .printStackTrace ();
534552 return ;
535553 }
@@ -542,6 +560,7 @@ public void test_WolfSSLSession_UseAfterFree() {
542560 return ;
543561 } catch (SocketTimeoutException | SocketException e ) {
544562 System .out .println ("\t \t ... failed" );
563+ fail ("Failed UseAfterFree test" );
545564 e .printStackTrace ();
546565 return ;
547566 }
@@ -619,6 +638,7 @@ public void test_WolfSSLSession_getSessionID() {
619638
620639 } catch (Exception e ) {
621640 System .out .println ("\t \t ... failed" );
641+ fail ("Failed getSessionID test" );
622642 e .printStackTrace ();
623643 return ;
624644 }
@@ -649,6 +669,7 @@ public void test_WolfSSLSession_useSecureRenegotiation() {
649669 ret = ssl .useSecureRenegotiation ();
650670 if (ret != WolfSSL .SSL_SUCCESS && ret != WolfSSL .NOT_COMPILED_IN ) {
651671 System .out .println ("... failed" );
672+ fail ("Failed useSecureRenegotiation test" );
652673 ssl .freeSSL ();
653674 sslCtx .free ();
654675 return ;
@@ -659,6 +680,7 @@ public void test_WolfSSLSession_useSecureRenegotiation() {
659680
660681 } catch (Exception e ) {
661682 System .out .println ("... failed" );
683+ fail ("Failed useSecureRenegotiation test" );
662684 e .printStackTrace ();
663685 return ;
664686 }
0 commit comments