Probably we should ask guys who contributed this part of functionality on how they see this issue needs to be addressed. Vasily On Feb 4, 2008 10:19 PM, Alexey Petrenko wrote: > If https in Harmony can not work through ssl and this code will solve > the problem. Then this shoould be done as default for Harmony. > > We should not expect any additiional tricks from the user to do > trivial job on Harmony.... > > > SY, Alexey > > 2008/2/4, Vasily Zakharov : > > Well, I'm not an SSL guru, but studying the specs suggests that you'd > > need something like this: > > > > class MySSLSocketFactory extends javax.net.ssl.SSLSocketFactory { > > SSLSocketFactory sf = (SSLSocketFactory) SSLSocketFactory.getDefault(); > > public String[] getDefaultCipherSuites() { > > return sf.getDefaultCipherSuites(); > > } > > public String[] getSupportedCipherSuites() { > > return sf.getSupportedCipherSuites(); > > } > > public Socket createSocket(Socket s, String host, int port, > > boolean autoClose) { > > SSLSocket socket = (SSLSocket) sf.createSocket(s, host, port, > > autoClose); > > socket.setEnabledProtocols(new String[] {"TLSv1"} ); > > return socket; > > } > > } > > > > and then: > > > > javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(new > > MySSLSocketFactory()); > > URL url = new URL("https://issues.apache.org/jira/browse/HARMONY-62"); > > InputStream is = url.openStream(); > > > > Vasily > > > > > > > > > > On Feb 4, 2008 3:13 PM, Alexey Petrenko wrote: > > > Here is my test case: > > > > > > === cut === > > > import java.io.FileOutputStream; > > > import java.io.InputStream; > > > import java.net.URL; > > > > > > public class HTTPSTest { > > > public static void main(String argv[]) throws Exception { > > > URL url = new URL("https://issues.apache.org/jira/browse/HARMONY-62"); > > > InputStream is = url.openStream(); > > > > > > FileOutputStream os = new FileOutputStream("HARMONY-62.html"); > > > > > > byte []buf = new byte[2048]; > > > int r; > > > do { > > > r = is.read(buf); > > > if (r > 0) > > > os.write(buf, 0, r); > > > } while (r != -1); > > > > > > is.close(); > > > os.close(); > > > } > > > } > > > === cut === > > > > > > Is there any way to set TLS as https transport in this case? > > > > > > SY, Alexey > > > > > > 2008/2/4, Vasily Zakharov : > > > > > > > I've tried Geronimo/Jetty a week ago, and HTTPS/TLS worked. > > > > > > > > Afaiu you must make sure you use TLS security, as Hamony doesn't have > > > > SSL support. > > > > > > > > Vasily > > > > > > > > > > > > On Feb 4, 2008 1:30 PM, Alexey Petrenko wrote: > > > > > Guys, > > > > > > > > > > does anybody knows the status of HTTPS connections possibility in > > > > > Harmony? Are they working? :) > > > > > > > > > > I wrote a small test which loads a page from our JIRA. And it fails > > > > > with the following stack trace: > > > > > > > > > > === cut === > > > > > Uncaught exception in main: > > > > > javax.net.ssl.SSLProtocolException: Unexpected message type has been > > > > > received: 72 > > > > > at org.apache.harmony.xnet.provider.jsse.SSLRecordProtocol.unwrap(SSLRecordProtocol.java:362) > > > > > at org.apache.harmony.xnet.provider.jsse.SSLSocketImpl.doHandshake(SSLSocketImpl.java:719) > > > > > at org.apache.harmony.xnet.provider.jsse.SSLSocketImpl.startHandshake(SSLSocketImpl.java:438) > > > > > at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.getSecureSocket(HttpConnection.java:168) > > > > > at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection$HttpsEngine.connect(HttpsURLConnection.java:398) > > > > > at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:871) > > > > > at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection.getInputStream(HttpsURLConnection.java:252) > > > > > at java.net.URL.openStream(URL.java:674) > > > > > at HTTPSTest.main(HTTPSTest.java:8) > > > > > === cut === > > > > > > > > > > Any ideas? > > > > > > > > > > Thanks in advance. > > > > > > > > > > SY, Alexey > > > > > > > > > > > > > > >