@Override
	public void run() {
		try {
			// Eclipse doesn't support System.console()
			BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
			ConfigManager config = NetBase.theNetBase().config();

			try {

				ElapsedTime.clear();

				String targetIP = config.getProperty("net.server.ip");
				if ( targetIP == null ) {
					System.out.print("Enter the server's ip, or empty line to exit: ");
					targetIP = console.readLine();
					if ( targetIP == null || targetIP.trim().isEmpty() ) return;
				}

				System.out.print("Enter the server's TCP port, or empty line to exit: ");
				String targetTCPPortStr = console.readLine();
				if ( targetTCPPortStr == null || targetTCPPortStr.trim().isEmpty() ) return;
				int targetTCPPort = Integer.parseInt( targetTCPPortStr );

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

				int socketTimeout = config.getAsInt("net.timeout.socket", 2000);

				if ( targetTCPPort != 0 ) {
	        ElapsedTimeInterval tcpmhResult = ping(EchoServiceBase.HEADER_STR, targetIP, targetTCPPort, socketTimeout, nTrials);
	        if ( tcpmhResult != null ) System.out.println(String.format("%.2f msec (%d failures)", tcpmhResult.mean(), tcpmhResult.nAborted()));
					System.out.println("Raw measurement info: " + ElapsedTime.statString());
				}

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