@Override
  public void run() {

    try {

      // Eclipse doesn't support System.console()
      BufferedReader console = new BufferedReader(new InputStreamReader(System.in));

      ConfigManager config = NetBase.theNetBase().config();
      String serverIP = config.getProperty("net.server.ip");
      if ( serverIP == null ) {
        System.out.print("Enter a host ip, or exit to exit: ");
        serverIP = console.readLine();
        if ( serverIP == null ) return;
        if ( serverIP.equals("exit")) return;
      } else System.out.print("Server location: " + serverIP + "\n");

      System.out.print("Enter port number, or empty line to exit: ");
      String portStr = console.readLine();
      if ( portStr == null || portStr.trim().isEmpty() ) return;
      int port = Integer.parseInt(portStr);

      int socketTimeout = config.getAsInt("net.timeout.socket", -1);
      if ( socketTimeout < 0 ) {
        System.out.print("Enter socket timeout (in msec.): ");
        String timeoutStr = console.readLine();
        socketTimeout = Integer.parseInt(timeoutStr);

      }

      System.out.print("Enter number of trials: ");
      String trialStr = console.readLine();
      int nTrials = Integer.parseInt(trialStr);

      int xferLength = -1; 
      do {
        System.out.print("Enter amount of data to transfer (-1 to exit): ");
        String xferLengthStr = console.readLine();
        xferLength = Integer.parseInt(xferLengthStr);
        if ( xferLength < 0) break;

        System.out.println("\n" + xferLength + " bytes");

        //-----------------------------------------------------
        // TCP transfer
        //-----------------------------------------------------

        TransferRateInterval tcpStats = DataXferRate(DataXferServiceBase.HEADER_STR, serverIP, port, socketTimeout, xferLength, nTrials);

        System.out.println("\nxfer rate = " + String.format("%9.0f", tcpStats.mean() * 1000.0) + " bytes/sec.");
        System.out.println("failure rate = " + String.format("%5.1f", tcpStats.failureRate()) +
                           " [" + tcpStats.nAborted()+ "/" + tcpStats.nTrials() + "]");
      } while ( xferLength >= 0 );

    } catch (Exception e) {
      System.out.println("Unanticipated exception: " + e.getMessage());
    }
  }