SSL handshake failed
Estou tentando consumir dados de uma API com certificado SSL. O seguinte código funciona normalmente no ambiente windows. Mas no Android eu recebo o erro:
totalcross.io.IOException: SSL handshake failed: -256
Versão TotalCross:
4.3.1 e 4.4.2
Código:
HttpStream hs = null;
try {
HttpStream.Options options = new HttpStream.Options();
String url = "https://jsonplaceholder.typicode.com/todos";
options.readTimeOut = 50000;
options.writeTimeOut = 50000;
options.openTimeOut = 50000;
options.httpType = HttpStream.GET;
options.socketFactory = SSLSocketFactory.getDefault();
hs = new HttpStream(new URI(url), options);
if (hs.responseCode == 200) {
StringBuffer b = new StringBuffer();
String l = null;
while ((l = hs.readLine()) != null) {
b.append(l).append("\r\n");
}
System.out.println("response: " + b.toString());
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (hs != null) {
try {
hs.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
Alguém sabe o que pode estar causando esse problema?
Edited by Guilherme Ribas