Index: test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java	(revision 1825)
+++ test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java	(revision 1826)
@@ -126,7 +126,8 @@
         suite.addTest(new MetacatClientTest("update"));
         suite.addTest(new MetacatClientTest("invalidDelete"));
         suite.addTest(new MetacatClientTest("delete"));
-        suite.addTest(new MetacatClientTest("inaccessiblemetacat"));
+        suite.addTest(new MetacatClientTest("inaccessibleMetacat"));
+        suite.addTest(new MetacatClientTest("reuseSession"));
         return suite;
     }
   
@@ -202,7 +203,6 @@
         } catch (Exception e) {
             fail("General exception:\n" + e.getMessage());
         }
-           
     }
 
     /**
@@ -403,7 +403,7 @@
      * inaccessible url. Then try to login it. If get a MetacatInaccessible
      * exception, this is right.
      */
-    public void inaccessiblemetacat()
+    public void inaccessibleMetacat()
     {
         Metacat mWrong = null;
         try {
@@ -422,6 +422,50 @@
     }
 
     /**
+     * Try to perform an action that requires a session to be valid without
+     * having logged in first by setting the sessionId from a previous
+     * session.  Then insert a document.
+     */
+    public void reuseSession()
+    {
+        String oldSessionId = "";
+        try {
+            Metacat mtemp = MetacatFactory.createMetacatConnection(metacatUrl);
+            String response = mtemp.login(username, password);
+            oldSessionId = mtemp.getSessionId();
+        } catch (MetacatAuthException mae) {
+            fail("Authorization failed:\n" + mae.getMessage());
+        } catch (MetacatInaccessibleException mie) {
+            System.err.println("Metacat is: " + metacatUrl);
+            fail("Metacat connection failed." + mie.getMessage());
+        }
+
+        try {
+            String identifier = generateDocid() + ".1";
+            Metacat m2 = null;
+            try {
+                m2 = MetacatFactory.createMetacatConnection(metacatUrl);
+            } catch (MetacatInaccessibleException mie) {
+                System.err.println("Metacat is: " + metacatUrl);
+                fail("Metacat connection failed." + mie.getMessage());
+            }
+            m2.setSessionId(oldSessionId);
+            String response = m2.insert(identifier, 
+                    new StringReader(testdocument), null);
+            System.err.println("Reuse Insert response: " + response);
+            assertTrue(response.indexOf("<success>") != -1);
+        } catch (MetacatInaccessibleException mie) {
+            fail("Metacat Inaccessible:\n" + mie.getMessage());
+        } catch (InsufficientKarmaException ike) {
+            fail("Insufficient karma:\n" + ike.getMessage());
+        } catch (MetacatException me) {
+            fail("Metacat Error:\n" + me.getMessage());
+        } catch (Exception e) {
+            fail("General exception:\n" + e.getMessage());
+        }
+    }
+
+    /**
      * Create a hopefully unique docid for testing insert and update. Does
      * not include the 'revision' part of the id.
      *
Index: src/edu/ucsb/nceas/metacat/client/MetacatClient.java
===================================================================
--- src/edu/ucsb/nceas/metacat/client/MetacatClient.java	(revision 1825)
+++ src/edu/ucsb/nceas/metacat/client/MetacatClient.java	(revision 1826)
@@ -399,6 +399,20 @@
         return this.sessionId;
     }
 
+    /**
+     * Set the session identifier for this session.  This identifier was 
+     * previously established with a call to login.  To continue to use the 
+     * same session, set the session id before making a call to one of the
+     * metacat access methods (e.g., read, query, insert, etc.).
+     *
+     * @param String the sessionId from a previously established session
+     */
+    public void setSessionId(String sessionId)
+    {
+        this.sessionId = sessionId;
+        HttpMessage.setCookie("JSESSIONID="+this.sessionId);
+    }
+
     /************************************************************************
      * PRIVATE METHODS
      ************************************************************************/
Index: src/edu/ucsb/nceas/metacat/client/Metacat.java
===================================================================
--- src/edu/ucsb/nceas/metacat/client/Metacat.java	(revision 1825)
+++ src/edu/ucsb/nceas/metacat/client/Metacat.java	(revision 1826)
@@ -152,4 +152,14 @@
      * @returns the sessionId as a String, or null if the session is invalid
      */
     public String getSessionId();
+
+    /**
+     * Set the session identifier for this session.  This identifier was 
+     * previously established with a call to login.  To continue to use the 
+     * same session, set the session id before making a call to one of the
+     * metacat access methods (e.g., read, query, insert, etc.).
+     *
+     * @param String the sessionId from a previously established session
+     */
+    public void setSessionId(String sessionId);
 }
