Esempio n. 1
0
  /** Spawn thread to open connection and start login process. */
  protected void startConnection() {
    transport = TransportFactory.getTransport(host.getProtocol());
    transport.setBridge(this);
    transport.setManager(manager);
    transport.setHost(host);

    // TODO make this more abstract so we don't litter on AbsTransport
    transport.setCompression(host.getCompression());
    transport.setUseAuthAgent(host.getUseAuthAgent());
    transport.setEmulation(emulation);

    if (transport.canForwardPorts()) {
      for (PortForwardBean portForward : manager.hostdb.getPortForwardsForHost(host))
        transport.addPortForward(portForward);
    }

    outputLine(
        manager.res.getString(
            R.string.terminal_connecting, host.getHostname(), host.getPort(), host.getProtocol()));

    Thread connectionThread =
        new Thread(
            new Runnable() {
              public void run() {
                transport.connect();
              }
            });
    connectionThread.setName("Connection");
    connectionThread.setDaemon(true);
    connectionThread.start();
  }