diff options
author | Kenny Root <kenny@the-b.org> | 2008-08-26 05:10:04 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2008-08-26 05:10:04 +0000 |
commit | c1e41c03ad352b00e88a926db600937f2ab06e50 (patch) | |
tree | 7397de044710bdab7947c0e02730dd48f2eb312a /src/com/trilead/ssh2/Session.java | |
parent | a92df389bc091f288116a292fd265e1986814865 (diff) | |
download | connectbot-c1e41c03ad352b00e88a926db600937f2ab06e50.tar.gz connectbot-c1e41c03ad352b00e88a926db600937f2ab06e50.tar.bz2 connectbot-c1e41c03ad352b00e88a926db600937f2ab06e50.zip |
Update Trilead SSH-2 for Java from build 211 to build 213
Diffstat (limited to 'src/com/trilead/ssh2/Session.java')
-rw-r--r-- | src/com/trilead/ssh2/Session.java | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/com/trilead/ssh2/Session.java b/src/com/trilead/ssh2/Session.java index 098b3f1..4784537 100644 --- a/src/com/trilead/ssh2/Session.java +++ b/src/com/trilead/ssh2/Session.java @@ -18,7 +18,7 @@ import com.trilead.ssh2.channel.X11ServerData; * a session. However, multiple sessions can be active simultaneously.
*
* @author Christian Plattner, plattner@trilead.com
- * @version $Id: Session.java,v 1.1 2007/10/15 12:49:56 cplattne Exp $
+ * @version $Id: Session.java,v 1.2 2008/03/03 07:01:36 cplattne Exp $
*/
public class Session
{
@@ -298,6 +298,32 @@ public class Session cm.requestSubSystem(cn, name);
}
+ /**
+ * This method can be used to perform end-to-end session (i.e., SSH channel)
+ * testing. It sends a 'ping' message to the server and waits for the 'pong'
+ * from the server.
+ * <p>
+ * Implementation details: this method sends a SSH_MSG_CHANNEL_REQUEST request
+ * ('trilead-ping') to the server and waits for the SSH_MSG_CHANNEL_FAILURE reply
+ * packet.
+ *
+ * @throws IOException in case of any problem or when the session is closed
+ */
+ public void ping() throws IOException
+ {
+ synchronized (this)
+ {
+ /*
+ * The following is just a nicer error, we would catch it anyway
+ * later in the channel code
+ */
+ if (flag_closed)
+ throw new IOException("This session is closed.");
+ }
+
+ cm.requestChannelTrileadPing(cn);
+ }
+
public InputStream getStdout()
{
return cn.getStdoutStream();
|