SSLProtocolException making a https connection
I have a SSLProtocolException when I'm making a https connection to my webserver. I only have this exception in Android 2.3 Gingebread; the same code works fine in all other Android versions. Is there any problem with this Android version?
I also have opened a bug开发者_高级运维 report with Google: http://code.google.com/p/android/issues/detail?id=16121&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
I have attached the Exception:
WARN/System.err(6218): javax.net.ssl.SSLProtocolException: Read error: ssl=0x3c97e8: Failure in SSL library, usually a protocol error WARN/System.err(6218): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(Native Method) WARN/System.err(6218): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:788) WARN/System.err(6218): at org.apache.harmony.luni.internal.net.www.protocol.http.FixedLengthInputStream.read(FixedLengthInputStream.java:44) WARN/System.err(6218): at java.io.BufferedInputStream.read(BufferedInputStream.java:319) WARN/System.err(6218): at android.os.Handler.dispatchMessage(Handler.java:99) WARN/System.err(6218): at android.os.Looper.loop(Looper.java:123) WARN/System.err(6218): at android.os.HandlerThread.run(HandlerThread.java:60)
Try using SSLSocketFactory
to read from the socket directly. I posted a test-case with commented code here: SSLProtocolException when reading https responses on Android 2.3.3 devices
check whether server want client authentication.In my case in tomcat server.xml clientAuth="true",so error was there so change i change it to false.
精彩评论