@@ -96,8 +96,8 @@ private static void _testDefaultOptions(Options o) {
9696 assertEquals (Options .DEFAULT_REQUEST_CLEANUP_INTERVAL , o .getRequestCleanupInterval (),
9797 "default cleanup interval" );
9898
99- assertTrue ( o .getErrorListener () instanceof ErrorListenerLoggerImpl , "error handler " );
100- assertNull (o .getConnectionListener (), "disconnect handler " );
99+ assertInstanceOf ( ErrorListenerLoggerImpl . class , o .getErrorListener (), "error listener " );
100+ assertNull (o .getConnectionListener (), "disconnect listener " );
101101 assertNull (o .getStatisticsCollector (), "statistics collector" );
102102 assertFalse (o .isOldRequestStyle (), "default oldstyle" );
103103 }
@@ -152,7 +152,7 @@ private static void _testChainedStringOptions(Options o) {
152152
153153 @ Test
154154 public void testChainedSecure () throws Exception {
155- SSLContext ctx = TestSSLUtils .createTestSSLContext ();
155+ SSLContext ctx = SslTestingHelper .createTestSSLContext ();
156156 SSLContext .setDefault (ctx );
157157 Options o = new Options .Builder ().secure ().build ();
158158 _testChainedSecure (ctx , o );
@@ -165,7 +165,7 @@ private static void _testChainedSecure(SSLContext ctx, Options o) {
165165
166166 @ Test
167167 public void testChainedSSLOptions () throws Exception {
168- SSLContext ctx = TestSSLUtils .createTestSSLContext ();
168+ SSLContext ctx = SslTestingHelper .createTestSSLContext ();
169169 Options o = new Options .Builder ().sslContext (ctx ).build ();
170170 _testChainedSSLOptions (ctx , o );
171171 _testChainedSSLOptions (ctx , new Options .Builder (o ).build ());
@@ -239,15 +239,15 @@ public void testHttpRequestInterceptors() {
239239
240240 @ Test
241241 public void testChainedErrorHandler () {
242- TestHandler handler = new TestHandler ();
243- Options o = new Options .Builder ().errorListener (handler ).build ();
244- _testChainedErrorHandler ( handler , o );
245- _testChainedErrorHandler ( handler , new Options .Builder (o ).build ());
242+ ListenerForTesting listener = new ListenerForTesting ();
243+ Options o = new Options .Builder ().errorListener (listener ).build ();
244+ _testChainedErrorListener ( listener , o );
245+ _testChainedErrorListener ( listener , new Options .Builder (o ).build ());
246246 }
247247
248- private static void _testChainedErrorHandler ( TestHandler handler , Options o ) {
248+ private static void _testChainedErrorListener ( ListenerForTesting listener , Options o ) {
249249 assertFalse (o .isVerbose (), "default verbose" ); // One from a different type
250- assertEquals (handler , o .getErrorListener (), "chained error handler " );
250+ assertEquals (listener , o .getErrorListener (), "chained error listener " );
251251 }
252252
253253 @ Test
@@ -260,8 +260,8 @@ public void testChainedConnectionListener() {
260260
261261 private static void _testChainedConnectionListener (ConnectionListener cHandler , Options o ) {
262262 assertFalse (o .isVerbose (), "default verbose" ); // One from a different type
263- assertTrue ( o .getErrorListener () instanceof ErrorListenerLoggerImpl , "error handler " );
264- assertSame (cHandler , o .getConnectionListener (), "chained connection handler " );
263+ assertInstanceOf ( ErrorListenerLoggerImpl . class , o .getErrorListener (), "error listener " );
264+ assertSame (cHandler , o .getConnectionListener (), "chained connection listener " );
265265 }
266266
267267 @ Test
@@ -274,7 +274,7 @@ public void testChainedStatisticsCollector() {
274274
275275 private static void _testChainedStatisticsCollector (StatisticsCollector cHandler , Options o ) {
276276 assertFalse (o .isVerbose (), "default verbose" ); // One from a different type
277- assertTrue ( o .getStatisticsCollector () instanceof TestStatisticsCollector , "statistics collector" );
277+ assertInstanceOf ( TestStatisticsCollector . class , o .getStatisticsCollector (), "statistics collector" );
278278 assertSame (cHandler , o .getStatisticsCollector (), "chained statistics collector" );
279279 }
280280
@@ -334,7 +334,7 @@ private static void _testPropertiesStringOptions(Options o) {
334334 @ Test
335335 public void testPropertiesSSLOptions () throws Exception {
336336 // don't use default for tests, issues with forcing algorithm exception in other tests break it
337- SSLContext .setDefault (TestSSLUtils .createTestSSLContext ());
337+ SSLContext .setDefault (SslTestingHelper .createTestSSLContext ());
338338 Properties props = new Properties ();
339339 props .setProperty (Options .PROP_SECURE , "true" );
340340
@@ -476,7 +476,7 @@ private static void _testProperties(Options o) {
476476 assertEquals (1000 , o .getPingInterval ().toMillis ());
477477 assertNotNull (o .getAuthHandler ());
478478 assertNotNull (o .getServerPool ());
479- assertTrue ( o .getServerPool () instanceof CoverageServerPool );
479+ assertInstanceOf ( CoverageServerPool . class , o .getServerPool ());
480480 }
481481
482482 @ Test
@@ -583,32 +583,32 @@ private static void _testPropertyDurationOptions(Options o) {
583583 }
584584
585585 @ Test
586- public void testPropertyErrorHandler () {
586+ public void testPropertyErrorListener () {
587587 Properties props = new Properties ();
588- props .setProperty (Options .PROP_ERROR_LISTENER , TestHandler .class .getCanonicalName ());
588+ props .setProperty (Options .PROP_ERROR_LISTENER , ListenerForTesting .class .getCanonicalName ());
589589
590590 Options o = new Options .Builder (props ).build ();
591591 assertFalse (o .isVerbose (), "default verbose" ); // One from a different type
592- assertNotNull (o .getErrorListener (), "property error handler " );
592+ assertNotNull (o .getErrorListener (), "property error listener " );
593593
594594 o .getErrorListener ().errorOccurred (null , "bad subject" );
595- assertEquals (((TestHandler ) o .getErrorListener ()).getCount (), 1 , "property error handler class" );
595+ assertEquals (((ListenerForTesting ) o .getErrorListener ()).getCount (), 1 , "property error listener class" );
596596 }
597597
598598 @ Test
599599 public void testPropertyConnectionListeners () {
600600 Properties props = new Properties ();
601- props .setProperty (Options .PROP_CONNECTION_CB , TestHandler .class .getCanonicalName ());
601+ props .setProperty (Options .PROP_CONNECTION_CB , ListenerForTesting .class .getCanonicalName ());
602602
603603 Options o = new Options .Builder (props ).build ();
604604 assertFalse (o .isVerbose (), "default verbose" ); // One from a different type
605- assertNotNull (o .getConnectionListener (), "property connection handler " );
605+ assertNotNull (o .getConnectionListener (), "property connection listener " );
606606
607607 o .getConnectionListener ().connectionEvent (null , Events .DISCONNECTED );
608608 o .getConnectionListener ().connectionEvent (null , Events .RECONNECTED );
609609 o .getConnectionListener ().connectionEvent (null , Events .CLOSED );
610610
611- assertEquals (((TestHandler ) o .getConnectionListener ()).getCount (), 3 , "property connect handler class" );
611+ assertEquals (((ListenerForTesting ) o .getConnectionListener ()).getCount (), 3 , "property connect listener class" );
612612 }
613613
614614 @ Test
@@ -654,7 +654,7 @@ public void testNonDefaultConnectOptions() {
654654
655655 @ Test
656656 public void testConnectOptionsWithNameAndContext () throws Exception {
657- SSLContext ctx = TestSSLUtils .createTestSSLContext ();
657+ SSLContext ctx = SslTestingHelper .createTestSSLContext ();
658658 Options o = new Options .Builder ().sslContext (ctx ).connectionName ("c1" ).build ();
659659 String expected = "{\" lang\" :\" java\" ,\" version\" :\" " + Nats .CLIENT_VERSION + "\" ,\" name\" :\" c1\" "
660660 + ",\" protocol\" :1,\" verbose\" :false,\" pedantic\" :false,\" tls_required\" :true,\" echo\" :true,\" headers\" :true,\" no_responders\" :true}" ;
@@ -679,7 +679,7 @@ public void testAuthConnectOptions() {
679679
680680 @ Test
681681 public void testNKeyConnectOptions () throws Exception {
682- TestAuthHandler th = new TestAuthHandler ();
682+ AuthHandlerForTesting th = new AuthHandlerForTesting ();
683683 byte [] nonce = "abcdefg" .getBytes (StandardCharsets .UTF_8 );
684684 String sig = Base64 .getUrlEncoder ().withoutPadding ().encodeToString (th .sign (nonce ));
685685
0 commit comments