java.net.SocketException: Connection reset

Hi,
While trying to use commonapi, I get this JAVA exception: java.net.SocketException: Connection reset

Here is a snapshot of my code:

URL url = new URL(“https://developers.onemap.sg/commonapi/search?searchVal=” + postalCode + “&returnGeom=Y&getAddrDetails=Y&pageNum=1”);

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod(“GET”);
conn.setRequestProperty(“Accept”, “application/json”);

int response = conn.getResponseCode() != 200; /* The exception is thrown here */

Please tell me what I am doing wrong here.

Thank you!

Problem solved by adding this line to my code:
System.setProperty(“https.protocols”, “TLSv1.1,TLSv1.2,SSLv3,SSLv2Hello”);

Hi @fhassani,

For your app security concern, please only allow “TLSv1.1,TLSv1.2” only