please find below code snippet where I'm trying to connect the server for the REST call using the HttpsURLConnection
I'm geeting error while doing inputstream on the HttpsURLConnection's object.
I don't the how can I connect HTTPS sevrer.
private String historyServerAddress
private URL historyServerURL
private String requestMethod
private HttpsURLConnection httpURLConnection
private String requestProperty
Connection createConnection(String historyServerAddress) {
System.setProperty("javax.net.ssl.trustStoreType","jks")
System.setProperty("javax.net.ssl.trustStore","ssl_truststore")
System.setProperty("javax.net.ssl.trustStorePassword","*****")
this.historyServerURL = new URL(historyServerAddress)
this.httpURLConnection = (HttpsURLConnection) this.historyServerURL.openConnection()
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory
.getDefault();
SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket(
"10.200.104.97", 19890)
sslsocket.startHandshake()
httpURLConnection.setSSLSocketFactory(sslsocketfactory)
}
}```