java.io.IOException: SSL handshake failure: Failure in SSL library, usually a protocol error

I'm trying to download some content using the URL class with a given link that comes from the server.

My code to download is it:

            URL url = new URL(downloadUrl);
            InputStream stream = url.openStream();
            byte[] content = new byte[stream.available()];
            stream.read(content);
            stream.close();

But when running I got the following exception:

 java.io.IOException: SSL handshake failure: Failure in SSL library, usually a protocol error
 error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:604 0xaf076228:0x00000000)
     at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.nativeconnect(Native Method)
 ...

The link I was using is something like:

https://contentserver.com/d/761/34/215656/5de1a41ea3bc9c81978af95ed19b03286f64d9a3

I know if I enter it on browser it donwload an File, I want download the same file throught Java.

Thanks

7
задан Marcos Vasconcelos 9 March 2011 в 18:36
поделиться