Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- class gobbler extends Thread {
- InputStream is;
- StringBuilder output;
- public gobbler(InputStream is) {
- this.is = is;
- output = new StringBuilder();
- }
- public String getOutput() {
- return output.toString();
- }
- public void run() {
- try {
- String line;
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
- while ((line = br.readLine()) != null) {
- output.append(line);
- output.append("\n");
- }
- } catch (IOException ioe) {
- ioe.printStackTrace();
- }
- }
- };
- public class props {
- public static void main(String[] args) throws Exception {
- Process process = Runtime.getRuntime().exec("openssl s_client -no_ign_eof -connect google.com:443 -cipher RC4-SHA");
- gobbler stdout = new gobbler(process.getInputStream());
- gobbler stderr = new gobbler(process.getErrorStream());
- stdout.start();
- stderr.start();
- process.getOutputStream().close();
- System.out.println("Waiting for process to terminate ...");
- process.waitFor();
- System.out.print(stdout.getOutput());
- System.out.print(stderr.getOutput());
- System.out.println("Exiting ...");
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement