title: Talend tRest connection reset error sending request to https endpoint
body: <p>I have a simple talend job (data integration) that uses a tRest component to connect to a rest service using a GET request that is outside our internal network. This works fine for a generic http URL but when using any https URL, the job 'hangs' for a while and then errors with the following:-</p>
  
  <pre><code>Exception in component tREST_1
  com.sun.jersey.api.client.ClientHandlerException: java.net.SocketException: Connection reset
  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:131)
  at com.sun.jersey.api.client.Client.handle(Client.java:616)
  at com.sun.jersey.api.client.WebResource.handle(WebResource.java:559)
  at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:72)
  at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:502)
  at darren_demos.test_rest2_0_1.Test_REST2.tREST_1Process(Test_REST2.java:596)
  at darren_demos.test_rest2_0_1.Test_REST2.runJobInTOS(Test_REST2.java:954)
  at darren_demos.test_rest2_0_1.Test_REST2.main(Test_REST2.java:811)
  Caused by: java.net.SocketException: Connection reset
  at java.net.SocketInputStream.read(SocketInputStream.java:196)
  at java.net.SocketInputStream.read(SocketInputStream.java:122)
  at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
  at sun.security.ssl.InputRecord.read(InputRecord.java:480)
  at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
  at sun.security.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1705)
  at sun.security.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:122)
  at sun.security.ssl.Handshaker.kickstart(Handshaker.java:909)
  at sun.security.ssl.SSLSocketImpl.kickstartHandshake(SSLSocketImpl.java:1423)
  at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1288)
  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.getOutputStream(HttpURLConnection.java:1091)
  at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler$1$1.getOutputStream(URLConnectionClientHandler.java:203)
  at com.sun.jersey.api.client.CommittingOutputStream.commitWrite(CommittingOutputStream.java:117)
  at com.sun.jersey.api.client.CommittingOutputStream.write(CommittingOutputStream.java:89)
  at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
  at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
  at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
  at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
  at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
  at java.io.BufferedWriter.flush(BufferedWriter.java:254)
  at com.sun.jersey.core.util.ReaderWriter.writeToAsString(ReaderWriter.java:191)
  at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:128)
  at com.sun.jersey.core.impl.provider.entity.StringProvider.writeTo(StringProvider.java:88)
  at com.sun.jersey.core.impl.provider.entity.StringProvider.writeTo(StringProvider.java:58)
  at com.sun.jersey.api.client.TerminatingClientHandler.writeRequestEntity(TerminatingClientHandler.java:305)
  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:182)
  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:129)
  ... 7 more
  [statistics] disconnected
  
  Job Test_REST2 ended at 15:16 11/05/2016. [exit code=1]
  </code></pre>
  
  <p>This seems to happen for any https endpoint I try. The URL's involved are accessible via a browser on same machine.</p>
  
  <p>Any thoughts on the cause? I have made sure that the root certificates involved are in the cacerts file of the jre but I don't think its getting that far.</p>