File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
jdbc-v2/src/test/java/com/clickhouse/jdbc Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -398,7 +398,7 @@ public void abortTest() throws SQLException {
398398 }
399399
400400 @ Test (groups = {"integration" })
401- public void testNetworkTimeout () throws SQLException {
401+ public void testNetworkTimeout () throws Exception {
402402 try (Connection conn = this .getJdbcConnection ()) {
403403 Assert .assertThrows (SQLException .class , () -> conn .setNetworkTimeout (null , 1000 ));
404404 Assert .assertThrows (SQLException .class , () -> conn .setNetworkTimeout (Executors .newSingleThreadExecutor (), -1 ));
@@ -408,13 +408,15 @@ public void testNetworkTimeout() throws SQLException {
408408 conn .setNetworkTimeout (executorService , timeout );
409409 Assert .assertEquals (conn .getNetworkTimeout (), timeout );
410410 Statement stmt = conn .createStatement ();
411- try {
412- ResultSet rs = stmt .executeQuery ("SELECT sleepEachRow(1) FROM system.numbers LIMIT 2" );
411+ try (ResultSet rs = stmt .executeQuery ("SELECT sleepEachRow(1) FROM system.numbers LIMIT 2" )) {
413412 fail ("Exception expected" );
414413 } catch (Exception e ) {
414+ executorService .shutdown ();
415+ executorService .awaitTermination (20 , TimeUnit .SECONDS );
415416 Assert .assertTrue (conn .isClosed ());
416417 Assert .assertFalse (conn .isValid (1000 ));
417418 conn .close ();
419+
418420 }
419421
420422 try {
You can’t perform that action at this time.
0 commit comments