static void run(String[] args) throws IOException { Command command = Command.splunk("test").parse(args); Service service = Service.connect(command.opts); String path = command.args.length > 0 ? command.args[0] : "/"; ResponseMessage response = service.get(path); int status = response.getStatus(); System.out.println(String.format("=> %d", status)); if (status != 200) return; BufferedReader reader = new BufferedReader(new InputStreamReader(response.getContent(), "UTF8")); while (true) { String line = reader.readLine(); if (line == null) break; System.out.println(line); } }