OkHttp3 throws java.net.SocketException: Connection reset Exception in Windows Server 2019

I am working on a client program to get Nifty50 & Nifty100 stocks data directly from NSE. For fetching the data, I've used squareup's OkHttp3 version 3.9.0, My code works fine on my local machine, but throws exception on my windows server. below are the details:

my java code:

package test;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.apache.commons.lang3.exception.ExceptionUtils;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

public class DownloadJSONData implements AutoCloseable 
{
    private String nifty50_old_url;
    private String nifty50_new_url;
    private String nifty100_old_url;
    private String nifty100_new_url;
    private String nifty50_old_json_data_file_path;
    private String nifty50_new_json_data_file_path;
    private String nifty100_old_json_data_file_path;
    private String nifty100_new_json_data_file_path;
    private String nifty_old_host;
    private String nifty_new_host;
    private String nifty_data;
    private List<String> nifty_urls;
    private List<String> nifty_files;
    private List<String> nifty_hosts;

    public DownloadJSONData()
    {   
        this.nifty50_old_url="https://www1.nseindia.com/live_market/dynaContent/live_watch/stock_watch/niftyStockWatch.json";
        this.nifty50_new_url="https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%2050";
        this.nifty100_old_url="https://www1.nseindia.com/live_market/dynaContent/live_watch/stock_watch/nifty100EqualWeightStockWatch.json";
        this.nifty100_new_url="https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20100";
        this.nifty50_old_json_data_file_path="C:\\test\\nifty50_old.txt";
        this.nifty50_new_json_data_file_path="C:\\test\\nifty50_new.txt";
        this.nifty100_old_json_data_file_path="C:\\test\\nifty100_old.txt";
        this.nifty100_new_json_data_file_path="C:\\test\\nifty100_new.txt";
        this.nifty_old_host="www1.nseindia.com";
        this.nifty_new_host="www.nseindia.com";
        this.nifty_data=null;
        this.nifty_urls=new ArrayList<String>();
        this.nifty_files=new ArrayList<String>();
        this.nifty_hosts=new ArrayList<String>();
    }   
    private void niftyUrlsFilesHostsSetter() throws Exception
    {
        this.nifty_urls.add(0, this.nifty50_old_url);
        this.nifty_urls.add(1, this.nifty50_new_url);
        this.nifty_urls.add(2, this.nifty100_old_url);
        this.nifty_urls.add(3,this.nifty100_new_url);
        this.nifty_files.add(0,this.nifty50_old_json_data_file_path);
        this.nifty_files.add(1, this.nifty50_new_json_data_file_path);
        this.nifty_files.add(2,this.nifty100_old_json_data_file_path);
        this.nifty_files.add(3, this.nifty100_new_json_data_file_path);
        this.nifty_hosts.add(0,this.nifty_old_host);
        this.nifty_hosts.add(1, this.nifty_new_host);
        this.nifty_hosts.add(2, this.nifty_old_host);
        this.nifty_hosts.add(3, this.nifty_new_host);
    }
    public void close()
    {
        this.nifty_data=null;
        System.gc();
    }
    public void fetchJSONData()
    {
        try
        {
            this.niftyUrlsFilesHostsSetter();
            for(int i=0; i<=3; i++)
            {
                System.out.println("Round: "+(i+1));
                this.fetchJSONDataPrivately(this.nifty_urls.get(i), this.nifty_files.get(i), this.nifty_hosts.get(i));
            }

        }
        catch (Exception e)
        {
            System.out.println("error/exception in fetching JSON data privately"+this.getClass().toString()+" is=\n"+ExceptionUtils.getStackTrace(e));
            this.close();
            System.exit(-1);
        }
        finally
        {
            System.out.println("Closing Resources");
            this.close();
        }
    }
    private void fetchJSONDataPrivately(String url, String file, String host) throws Exception
    {
        OkHttpClient client=new OkHttpClient.Builder()
                            .connectTimeout(2, TimeUnit.MINUTES)
                            .writeTimeout(2, TimeUnit.MINUTES)
                            .readTimeout(2, TimeUnit.MINUTES)
                            .retryOnConnectionFailure(true).build();
        System.out.println("Going to fetch for:\n"+"URL: "+url+"\nFile: "+file+"\n Host: "+host);
        Request request=new Request.Builder()
                  .url(url)
                  .method("GET", null)
                  .header("Connection", "Keep-Alive")
                  .header("User-Agent", "PostmanRuntime/7.24.1")
                  .build(); 
        Response response=client.newCall(request).execute();
        this.nifty_data=response.body().string();
        System.out.println("Fetch complete, now storing");
        Files.write(Paths.get(file), this.nifty_data.getBytes());
        System.out.println("Store Complete");
        client=null;
        request=null;
        response=null;
        System.gc();
    }

    public static void main(String args[])
    {
        DownloadJSONData obj=new DownloadJSONData();
        obj.fetchJSONData();
        obj.close();
    }
}

I've created a executable jar file of this java class and when I run jar file on my local windows machine, it works perfectly fine.

C:\test>java -jar downloadjsondata.jar
Round: 1
Going to fetch for:
URL: https://www1.nseindia.com/live_market/dynaContent/live_watch/stock_watch/niftyStockWatch.json
File: C:\test\nifty50_old.txt
 Host: www1.nseindia.com
Fetch complete, now storing
Store Complete
Round: 2
Going to fetch for:
URL: https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%2050
File: C:\test\nifty50_new.txt
 Host: www.nseindia.com
Fetch complete, now storing
Store Complete
Round: 3
Going to fetch for:
URL: https://www1.nseindia.com/live_market/dynaContent/live_watch/stock_watch/nifty100EqualWeightStockWatch.json
File: C:\test\nifty100_old.txt
 Host: www1.nseindia.com
Fetch complete, now storing
Store Complete
Round: 4
Going to fetch for:
URL: https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%20100
File: C:\test\nifty100_new.txt
 Host: www.nseindia.com
Fetch complete, now storing
Store Complete
Closing Resources

But, the problem is that when I run the same jar on my AWS EC2 Windows Server 2019 instance, it throws below exception. help needed over here.

C:\test>java -jar downloadjsondata.jar
Round: 1
Going to fetch for:
URL: https://www1.nseindia.com/live_market/dynaContent/live_watch/stock_watch/niftyStockWatch.json
File: C:\test\nifty50_old.txt
 Host: www1.nseindia.com
error/exception in fetching JSON data privatelyclass test.DownloadJSONData is=
java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(Unknown Source)
        at java.net.SocketInputStream.read(Unknown Source)
        at sun.security.ssl.InputRecord.readFully(Unknown Source)
        at sun.security.ssl.InputRecord.read(Unknown Source)
        at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
        at sun.security.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
        at sun.security.ssl.AppInputStream.read(Unknown Source)
        at okio.Okio$2.read(Okio.java:139)
        at okio.AsyncTimeout$2.read(AsyncTimeout.java:237)
        at okio.RealBufferedSource.indexOf(RealBufferedSource.java:345)
        at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:217)
        at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:211)
        at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:187)
        at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
        at okhttp3.RealCall.execute(RealCall.java:77)
        at test.DownloadJSONData.fetchJSONDataPrivately(DownloadJSONData.java:105)
        at test.DownloadJSONData.fetchJSONData(DownloadJSONData.java:75)
        at test.DownloadJSONData.main(DownloadJSONData.java:119)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)