title: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
body: <p>I am launching a JNLP downloaded from my web application.
  After being prompted with a Java Security Warning prompt, the application can run successfully if the user response is within 2-3 seconds. However, if the user took more than 3 seconds to respond to the Java Security Warning prompt, the application fails to run with error with the following socket exception: </p>
  
  <pre><code> javax.net.ssl.SSLHandshakeException: Remote host closed connection during 
  
  handshake
      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:946)
      at sun.security.ssl.SSLSocketImpl.performInitialHandshake
  
  (SSLSocketImpl.java:1312)
      at sun.security.ssl.SSLSocketImpl.startHandshake
  
  (SSLSocketImpl.java:1339)
      at sun.security.ssl.SSLSocketImpl.startHandshake
  
  (SSLSocketImpl.java:1323)
      at sun.net.www.protocol.https.HttpsClient.afterConnect
  
  (HttpsClient.java:563)
      at 
  
  sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
  
  (AbstractDelegateHttpsURLConnection.java:185)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream
  
  (HttpURLConnection.java:1300)
      at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream
  
  (HttpsURLConnectionImpl.java:254)
      at com.sun.deploy.net.HttpUtils.followRedirects(Unknown Source)
      at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
      at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
      at com.sun.deploy.cache.ResourceProviderImpl.checkUpdateAvailable
  
  (Unknown Source)
      at com.sun.deploy.cache.ResourceProviderImpl.isUpdateAvailable(Unknown 
  
  Source)
      at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
      at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
      at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker
  
  (ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run
  
  (ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.io.EOFException: SSL peer shut down incorrectly
      at sun.security.ssl.InputRecord.read(InputRecord.java:482)
      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
      ... 19 more
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/b5Oz6.png" rel="nofollow">Java Security Warning</a></p>
  
  <p><a href="http://i.stack.imgur.com/NBJyN.png" rel="nofollow">Exception</a></p>
  
  <p>Additional Info: I have checked the ports and they were pointing on the correct port numbers and TLS value also matched. The certificates were also added under cacerts. </p>
  
  <p>Question: What causes the exception when response to the security prompt reaches more than 3-5 seconds? and how can I avoid the mentioned exception(possibly increase the waiting time)?  </p>
  
  <p>Actions done: 
  1. Add connectionTimeout attribute in Tomcat connector, but still, after 5 seconds of waiting time to respond to the Java Security Warning, the application still fails to launch. </p>