Index: java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java	(revision 627423)
+++ java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java	(working copy)
@@ -145,6 +145,7 @@
         suite.addTest(new J2EEDataSourceTest("testClosedCPDSConnection"));
         suite.addTest(new J2EEDataSourceTest("testClosedXADSConnection"));
         suite.addTest(new J2EEDataSourceTest("testSetSchemaInXAConnection"));
+        suite.addTest(new J2EEDataSourceTest("testPooledReuseOnClose"));
         return suite;
     }
 
@@ -172,11 +173,6 @@
     private static Test getEmbeddedSuite(String postfix) {
         TestSuite suite = new TestSuite("Embedded" + postfix);
         suite.addTest(new J2EEDataSourceTest("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 J2EEDataSourceTest("testPooledReuseOnClose"));
         // when DERBY-2498 gets fixed, move this one to baseSuite
         suite.addTest(new J2EEDataSourceTest("testJira95pds"));
         // Following cannot run with client because of DERBY-2533; it hangs
Index: java/client/org/apache/derby/client/ClientPooledConnection.java
===================================================================
--- java/client/org/apache/derby/client/ClientPooledConnection.java	(revision 627423)
+++ java/client/org/apache/derby/client/ClientPooledConnection.java	(working copy)
@@ -300,6 +300,10 @@
             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 =
                     (ConnectionEventListener)e.next();
@@ -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 627423)
+++ 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 627423)
+++ java/client/org/apache/derby/client/net/Request.java	(working copy)
@@ -61,6 +61,14 @@
     //  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.
@@ -815,6 +823,33 @@
         }
     }
 
+    /**
+     * 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
+
+        // Only change chaining bits if there is evidence of more than one DSS.
+        if (previousUsedDssMark > 0) {
+            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 +1714,7 @@
     
 
     public void setDssLengthLocation(int location) {
+        previousUsedDssMark = dssLengthLocation_;
         dssLengthLocation_ = location;
     }
     
