title: I/O error on POST request for... java.net.SocketException: Connection reset
body: <p>I am using Spring <code>Rest Template</code> to call a REST service that is hosted at an SSL endpoint. After the first request, I am getting the below error. The environment is AWS EC2, <code>Open JDK 1.8.161</code>, <code>Linux</code>. The endpoint only supports <code>TLSv1.2</code> and <code>1.3</code>. </p>
  
  <pre><code> org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://mycompany.com": Connection reset; nested exception is java.net.SocketException: Connection reset
          at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:743)
          at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:686)
          at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:437)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      ... more stack here
  Caused by: java.net.SocketException: Connection reset
      at java.net.SocketInputStream.read(SocketInputStream.java:210)
      at java.net.SocketInputStream.read(SocketInputStream.java:141)
      at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
      at sun.security.ssl.InputRecord.read(InputRecord.java:503)
      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
      at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:940)
      at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
      at .....
      ... 107 common frames omitted
  </code></pre>
  
  <p>Any guidance will be greatly appreciated=!!</p>