I am trying to connect to a secure web page (https) and read the contents, all sounds simple right? I have to go through a proxy. I am using JSSE 1.01 and basicaly running one of the samples that comes with JSSE. This is the code...<br><br>// set up ssl socket to do tunneling through proxy<br>tunnelHost = System.getProperty("https.proxyHost"
;<br>tunnelPort = Integer.getInteger("https.proxyPort"
.intValue();<br><br>Socket tunnel = new Socket(tunnelHost, tunnelPort);<br>doTunnelHandshake(tunnel, host, port);<br>SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();<br>SSLSocket socket = (SSLSocket)factory.createSocket(tunnel, host, port, true);<br><br>// register a callback for handshaking completion event<br>socket.addHandshakeCompletedListener(new HandshakeCompletedListener() {<br>public void handshakeCompleted(HandshakeCompletedEvent event) {<br> System.out.println("Handshake finished!"
;<br> System.out.println("\t CipherSuite:" + event.getCipherSuite());<br> System.out.println("\t SessionId " + event.getSession());<br> System.out.println("\t PeerHost " + event.getSession().getPeerHost());<br>}<br>});<br><br>// send http request<br>PrintWriter out = new PrintWriter(<br>new BufferedWriter(<br> new OutputStreamWriter(<br> socket.getOutputStream())));<br><br>out.println("GET <A HREF=" TARGET="_new"> HTTP/1.1"
;<br>out.println();<br>out.flush();<br><br>// read response<br>BufferedReader in = new BufferedReader(<br> new InputStreamReader(<br> socket.getInputStream()));<br><br>String inputLine;<br><br>while ((inputLine = in.readLine()) != null)<br>System.out.println(inputLine);<br><br>in.close();<br><br>----------------------------------------------<br>If I run the code Im told that the line:<br> out.flush();<br>Causes exception:<br>java.lang.IllegalArgumentException<br> void java.io.PrintWriter.flush()<br> void SSLSocketClientWithTunneling.doIt(java.lang.String, int)<br> void SSLSocketClientWithTunneling.main(java.lang.String[])<br><br>But, if I run the code in debug mode and add a break point on the out.flush() line and use debug to step over it the code works fine?<br><br>Any help would be well received.<br><br>fl@5h