protected void createTunnel(XMLElement e) throws IOException {

    String hostname = (String) e.getAttribute("hostname"); // $NON-NLS-1$
    String name = (String) e.getAttribute("name"); // $NON-NLS-1$
    int port = Integer.parseInt((String) e.getAttribute("port")); // $NON-NLS-1$
    boolean usePreferredPort =
        ("true".equals(e.getAttribute("usePreferredPort"))); // $NON-NLS-1$ //$NON-NLS-2$
    boolean singleConnection =
        !("false".equals(e.getAttribute("singleConnection"))); // $NON-NLS-1$ //$NON-NLS-2$
    boolean localhostWorkaround =
        "true".equals(e.getAttribute("localhostWorkaround")); // $NON-NLS-1$ //$NON-NLS-2$
    if (events != null) {
      TunnelConfiguration listeningSocketConfiguration =
          events.createTunnel(
              name,
              hostname,
              port,
              usePreferredPort,
              singleConnection,
              localhostWorkaround ? "127.0.0.2" : agent.getConfiguration().getLocalhostAddress());
      tunnels.addElement(listeningSocketConfiguration);
    } else
      throw new IOException(
          Messages.getString("ApplicationLauncher.tunnelRequiredButNoEventHandler")); // $NON-NLS-1$
  }
 /**
  * Constructor.
  *
  * @param vpn agent
  * @param parameters parameters
  * @param events events callback
  */
 public AgentApplicationLauncher(
     Agent vpn,
     String name,
     Hashtable parameters,
     String descriptor,
     ApplicationLauncherEvents events) {
   super(
       vpn.getConfiguration().getCacheDir(),
       "https",
       vpn.getUsername(),
       vpn.getAditoHost(),
       vpn.getAditoPort(),
       parameters,
       events);
   this.agent = vpn;
   this.name = name;
   this.descriptor = descriptor;
 }