# HG changeset patch
# User Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
# Date 1631604201 -7200
# Node ID d1f6678f92c5e47f3303eda7984a5b60c6295c4f
# Parent  8029d7368b5afb6ca71230e97e650253f8f3c213
Test that throwing an IO Exception in the download handler invalidates the connection

At the moment we cannot report the error to the server.
It is easier to invalidate the connection now and switch to something more sophisticated
in the future than the other way around.

diff --git a/tests/OnClientTester.java b/tests/OnClientTester.java
--- a/tests/OnClientTester.java
+++ b/tests/OnClientTester.java
@@ -237,13 +237,14 @@ public final class OnClientTester extend
 	}
 
 	// Disabled because it hangs, triggering the watchdog timer
-	public void testx_FailDownloadLate() throws SQLException, Failure {
+	public void test_FailDownloadLate() throws SQLException, Failure {
 		prepare();
 		MyDownloadHandler handler = new MyDownloadHandler(200, "download refused");
 		conn.setDownloadHandler(handler);
 		update("INSERT INTO foo SELECT value as i, 'number' || value AS t FROM sys.generate_series(0, 100)", 100);
-		expectError("COPY (SELECT * FROM foo) INTO 'banana' ON CLIENT", "download refused");
-		queryInt("SELECT 42 -- check if the connection still works", 42);
+		expectError("COPY (SELECT * FROM sys.generate_series(0,200)) INTO 'banana' ON CLIENT", "download refused");
+		// Exception closes the connection
+		assertEq("connection is closed", conn.isClosed(), true);
 	}
 
 	static class MyUploadHandler implements UploadHandler {