public boolean handshake() {
    if (!isCommunicationClosed()) {
      try {
        return "PyCharm".equals(getPythonConsoleBackendClient().handshake());
      }
      catch (CommunicationClosedException | PyConsoleProcessFinishedException e) {
        return false;
      }
      catch (TException e) {
        throw new RuntimeException(e);
      }
    }
    else {
      return false;
    }
  }
public boolean handshake()