1 package org.ibex.net.ssl;
3 import org.ibex.net.SSL;
7 public static void main(String[] args) throws Exception {
9 if(args.length < 2) { System.err.println("Usage: SSL host port"); }
10 String host = args[0];
11 int port = Integer.parseInt(args[1]);
12 SSL ssl = new SSL(host,port);
14 ssl.getOutputStream().write(SSL.getBytes("GET / HTTP/1.0\r\nHost: " + host + "\r\n\r\n"));
15 cat(ssl.getInputStream());
19 ssl = new SSL(host,port,ssl.getSessionState());
20 ssl.getOutputStream().write(SSL.getBytes("GET / HTTP/1.0\r\nHost: " + host + "\r\n\r\n"));
21 cat(ssl.getInputStream());
24 private static void cat(InputStream is) throws IOException {
25 BufferedReader br = new BufferedReader(new InputStreamReader(is));
29 while((line = br.readLine()) != null && --count >= 0) System.out.println(line);
30 } catch(SSL.PrematureCloseExn e) { /* ignore */ }