in tchannel-example/src/main/java/com/uber/tchannel/ping/PingClient.java [55:78]
public static void main(String[] args) throws Exception {
Options options = new Options();
options.addOption("h", "host", true, "Server Host to connect to");
options.addOption("p", "port", true, "Server Port to connect to");
options.addOption("n", "requests", true, "Number of requests to make");
options.addOption("?", "help", false, "Usage");
HelpFormatter formatter = new HelpFormatter();
CommandLineParser parser = new DefaultParser();
CommandLine cmd = parser.parse(options, args);
if (cmd.hasOption("?")) {
formatter.printHelp("PingClient", options, true);
return;
}
String host = cmd.getOptionValue("h", "localhost");
int port = Integer.parseInt(cmd.getOptionValue("p", "8888"));
int requests = Integer.parseInt(cmd.getOptionValue("n", "10000"));
System.out.println(String.format("Connecting from client to server on port: %d", port));
new PingClient(host, port, requests).run();
System.out.println("Stopping Client...");
}