midrange.com code scratchpad |
Name:
SSL Tester for System i
|
Scriptlanguage:
Java
|
Tabwidth:
4
|
Date:
11/08/2007 07:53:57 pm
|
IP:
Logged
|
|
Description:
The user was to lazy to give a description
|
Code:
- import java.io.*;
- import java.net.*;
-
- public class TestSSL {
-
- public static void main(String[] args) {
- try {
- System.out.println("Consturcting URL");
- URL url = new URL("https:
- System.out.println("Connecting to URL");
- URLConnection uc = url.openConnection();
- System.out.println("Opening connection");
- uc.connect();
- System.out.println("Getting input stream");
- InputStream is = uc.getInputStream();
- System.out.println("Constructing reader");
- BufferedReader reader = new BufferedReader(new InputStreamReader(is));
-
- System.out.println("Reading first line");
- String input = reader.readLine();
- int line = 1;
- while (input != null) {
- System.out.println("Line #" + line++ + ":" + input);
- System.out.println("Reading subsequent lines");
- input = reader.readLine();
- }
- System.out.println("Closing connection");
- is.close();
- } catch (MalformedURLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- }
-
|
|
|