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 {
398
398
}
399
399
400
400
@ Test (groups = {"integration" })
401
- public void testNetworkTimeout () throws SQLException {
401
+ public void testNetworkTimeout () throws Exception {
402
402
try (Connection conn = this .getJdbcConnection ()) {
403
403
Assert .assertThrows (SQLException .class , () -> conn .setNetworkTimeout (null , 1000 ));
404
404
Assert .assertThrows (SQLException .class , () -> conn .setNetworkTimeout (Executors .newSingleThreadExecutor (), -1 ));
@@ -408,13 +408,15 @@ public void testNetworkTimeout() throws SQLException {
408
408
conn .setNetworkTimeout (executorService , timeout );
409
409
Assert .assertEquals (conn .getNetworkTimeout (), timeout );
410
410
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" )) {
413
412
fail ("Exception expected" );
414
413
} catch (Exception e ) {
414
+ executorService .shutdown ();
415
+ executorService .awaitTermination (20 , TimeUnit .SECONDS );
415
416
Assert .assertTrue (conn .isClosed ());
416
417
Assert .assertFalse (conn .isValid (1000 ));
417
418
conn .close ();
419
+
418
420
}
419
421
420
422
try {
You can’t perform that action at this time.
0 commit comments