Index: java/client/org/apache/derby/client/ClientPooledConnection.java
===================================================================
--- java/client/org/apache/derby/client/ClientPooledConnection.java	(revision 620487)
+++ java/client/org/apache/derby/client/ClientPooledConnection.java	(working copy)
@@ -299,6 +299,10 @@
         if (physicalConnection_.agent_.loggingEnabled()) {
             physicalConnection_.agent_.logWriter_.traceEntry(this, "recycleConnection");
         }
+        
+        // Null out the reference to the logical connection that is currently
+        // being closed.
+        this.logicalConnection_ = null;
 
         for (Iterator e = listeners_.iterator(); e.hasNext();) {
             ConnectionEventListener listener =
@@ -316,7 +320,7 @@
      * 
      * @param exception the exception that occurred on the connection
      */
-    public void trashConnection(SqlException exception) {
+    public void informListeners(SqlException exception) {
 		// only report fatal error  
 		if (exception.getErrorCode() < ExceptionSeverity.SESSION_SEVERITY)
 			return;
@@ -333,8 +337,8 @@
     }
 
     /**
-     * Used by <code>LogicalConnection.close</code> when it disassociates itself
-     * from the pooled connection.
+     * Used by {@code LogicalConnection.close} in some circumstances when
+     * it disassociates itself from the pooled connection.
      */
     public synchronized void nullLogicalConnection() {
         logicalConnection_ = null;
Index: java/client/org/apache/derby/client/net/NetAgent.java
===================================================================
--- java/client/org/apache/derby/client/net/NetAgent.java	(revision 620487)
+++ java/client/org/apache/derby/client/net/NetAgent.java	(working copy)
@@ -463,6 +463,7 @@
     }
 
     protected void endWriteChain() {
+        request_.endDssChain();
         super.endWriteChain();
     }
 
Index: java/client/org/apache/derby/client/net/Request.java
===================================================================
--- java/client/org/apache/derby/client/net/Request.java	(revision 620487)
+++ java/client/org/apache/derby/client/net/Request.java	(working copy)
@@ -61,7 +61,15 @@
     //  the length bytes can be automatically
     //  updated as information is added to this stream.
     private int dssLengthLocation_ = 0;
-
+    /**
+     * Index for the previously used DSS mark.
+     * <p>
+     * The reference is kept to be able to change the chaining bits of the
+     * previously written DSS. It is assumed that when the request is flushed,
+     * the last DSS should have its chaining bits set to no chaining.
+     */
+    private int previousUsedDssMark = 0;
+    
     // tracks the request correlation ID to use for commands and command objects.
     // this is automatically updated as commands are built and sent to the server.
     private int correlationID_ = 0;
@@ -815,6 +823,29 @@
         }
     }
 
+    /**
+     * Ends the existing chain of DSS objects by setting the chaining bits to
+     * indicate no chaining.
+     */
+    final void endDssChain() {
+        // Make sure chaining bits indicate no chaining.
+        // Expected format at mostRecentDssMark in the byte array:
+        //      (cl)(Cf)(rc) - we want to change byte f.
+        // Only change valid values, which are:
+        //      0x01 = a reply DSS with no chaining (no change needed)
+        //      0x41 = a reply DSS, chained: next DSS has different correlator
+        //      0x51 = a reply DSS, chained: next DSS has the same correlator
+        byte bytef = bytes_[previousUsedDssMark +3];
+        if (bytef == DssConstants.RQST_CHN_DIFFCOR_NOCONT ||
+                bytef == DssConstants.RQST_CHN_SAMECOR_NOCONT) {
+            // Force chaining bits for the reply to indicate no chaining,
+            // otherwise client and server might both end up waiting for
+            // each other (hang).
+            bytes_[previousUsedDssMark + 3] =
+                    DssConstants.RQST_NOCHN_NOCONT;
+        }
+    }
+
     // method to determine if any data is in the request.
     // this indicates there is a dss object already in the buffer.
     protected final boolean doesRequestContainData() {
@@ -1679,6 +1710,7 @@
     
 
     public void setDssLengthLocation(int location) {
+        previousUsedDssMark = dssLengthLocation_;
         dssLengthLocation_ = location;
     }
     
Index: java/client/org/apache/derby/client/am/LogicalConnection.java
===================================================================
--- java/client/org/apache/derby/client/am/LogicalConnection.java	(revision 620487)
+++ java/client/org/apache/derby/client/am/LogicalConnection.java	(working copy)
@@ -73,7 +73,7 @@
 
             if (physicalConnection_.isClosed()) // connection is closed or has become stale
             {
-                pooledConnection_.trashConnection(new SqlException(null, 
+                pooledConnection_.informListeners(new SqlException(null, 
                     new ClientMessageId(
                         SQLState.PHYSICAL_CONNECTION_ALREADY_CLOSED)));
             } else {
@@ -142,7 +142,7 @@
      */
 	final void notifyException(SQLException sqle) {
         if (physicalConnection_ != null) 
-        	pooledConnection_.trashConnection(new SqlException(sqle));
+        	pooledConnection_.informListeners(new SqlException(sqle));
 	}
 
     // ---------------------- wrapped public entry points ------------------------
Index: java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceTest.java
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceTest.java	(revision 620487)
+++ java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceTest.java	(working copy)
@@ -146,6 +146,7 @@
         suite.addTest(new DataSourceTest("testClosedCPDSConnection"));
         suite.addTest(new DataSourceTest("testClosedXADSConnection"));
         suite.addTest(new DataSourceTest("testSetSchemaInXAConnection"));
+        suite.addTest(new DataSourceTest("testPooledReuseOnClose"));
         return suite;
     }
 
@@ -173,11 +174,6 @@
     private static Test getEmbeddedSuite(String postfix) {
         TestSuite suite = new TestSuite("Embedded" + postfix);
         suite.addTest(new DataSourceTest("testDSRequestAuthentication"));
-        // Due to a bug following cannot be run for client - DERBY-3379
-        // To run this fixture with client, add to getClientSuite(),
-        // when DERBY-3379 is fixed, remove from here (and client) and
-        // move to baseSuite.
-        suite.addTest(new DataSourceTest("testPooledReuseOnClose"));
         // when DERBY-2498 gets fixed, move these two to baseSuite
         suite.addTest(new DataSourceTest("testJira95ds"));
         suite.addTest(new DataSourceTest("testJira95pds"));
