public synchronized void ping() throws IOException {
  if (tm == null)   throw new IllegalStateException("You need to establish a connection first.");
  if (!authenticated)   throw new IllegalStateException("The connection is not authenticated.");
  cm.requestGlobalTrileadPing();
}

public synchronized void ping ( ) throws IOException { if ( tm == null ) throw new IllegalStateException ( "You need to establish a connection first." ) ; if ( ! authenticated ) throw new IllegalStateException ( "The connection is not authenticated." ) ; cm . requestGlobalTrileadPing ( ) ; }
this method can be used to perform end - to - end connection testing . it sends a ' ping ' message to the server and waits for the ' pong ' from the server . < p > when this method throws an exception , then you can assume that the connection should be abandoned . < p > note : works only after one has passed successfully the authentication step . < p > implementation details : this method sends a ssh_msg_global_request request ( ' trilead - ping ' ) to the server and waits for the ssh_msg_request_failure reply packet from the server .
