/**
   * Determines whether the contact is connected to shell of remote machine as a precheck for any
   * further operation
   *
   * @param sshContact ID of SSH Contact
   * @return <tt>true</tt> if the contact is connected <tt>false</tt> if the contact is not
   *     connected
   */
  public boolean isShellConnected(ContactSSH sshContact) {
    // a test command may also be run here

    if (isSessionValid(sshContact)) {
      return (sshContact.getShellChannel() != null);
    }

    /*
     * Above should be return(sshContact.getShellChannel() != null
     *                     && sshContact.getShellChannel().isConnected());
     *
     * but incorrect reply from stack for isConnected()
     */

    return false;
  }
 /**
  * Closes the Shell channel are associated IO Streams
  *
  * @param sshContact ID of SSH Contact
  */
 public void closeShellChannel(ContactSSH sshContact) throws JSchException, IOException {
   sshContact.closeShellIO();
   sshContact.getShellChannel().disconnect();
   sshContact.setShellChannel(null);
 }