aboutsummaryrefslogtreecommitdiffstats
path: root/lib/src/main/java/com/trilead/ssh2/Session.java
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2008-08-26 05:10:04 +0000
committerKenny Root <kenny@the-b.org>2008-08-26 05:10:04 +0000
commitc36f336e6f294313cdab84352b108beea4607e48 (patch)
treec1114a0e6bb24a48e69fe80e03ad31f3e5bb8f4a /lib/src/main/java/com/trilead/ssh2/Session.java
parentb4261695b2687ed43821ada65abe14d87604ba74 (diff)
downloadsshlib-c36f336e6f294313cdab84352b108beea4607e48.tar.gz
sshlib-c36f336e6f294313cdab84352b108beea4607e48.tar.bz2
sshlib-c36f336e6f294313cdab84352b108beea4607e48.zip
Update Trilead SSH-2 for Java from build 211 to build 213
Diffstat (limited to 'lib/src/main/java/com/trilead/ssh2/Session.java')
-rw-r--r--lib/src/main/java/com/trilead/ssh2/Session.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/src/main/java/com/trilead/ssh2/Session.java b/lib/src/main/java/com/trilead/ssh2/Session.java
index 098b3f1..4784537 100644
--- a/lib/src/main/java/com/trilead/ssh2/Session.java
+++ b/lib/src/main/java/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();