Forum Discussion

arunbharath's avatar
arunbharath
Contributor
4 years ago
Solved

Getting : ERROR: Exception in request: java.net.SocketException: Connect

Hi All, Recent times I'm facing ERROR: Exception in request: java.net.SocketException: Connection reset  a lot. Everytime has to run 3 to 4 times to execute the API. I don't know what is the issue here? I tried couple of solution from internet but I couldn't fixed it. Any inputs to resolve this would be appreciated. Because it really kills the automation and has to run every API 3 to 4 times to get success. 

Tue May 05 16:51:23 UTC 2020: ERROR: Exception in request: java.net.SocketException: Connection reset
Tue May 05 16:51:23 UTC 2020: ERROR: An error occurred [Connection reset], see error log for details


HTTP-LOG
=========
[write] I/O error: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset


ERROR-LOG
=========
Tue May 05 16:51:23 UTC 2020: ERROR: java.net.SocketException: Connection reset
   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.waitForClose(Unknown Source)
   	at sun.security.ssl.HandshakeOutStream.flush(Unknown Source)
   	at sun.security.ssl.Handshaker.kickstart(Unknown Source)
   	at sun.security.ssl.SSLSocketImpl.kickstartHandshake(Unknown Source)
   	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
   	at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source)
   	at sun.security.ssl.AppOutputStream.write(Unknown Source)
   	at com.eviware.soapui.impl.wsdl.support.http.SoapUILoggingOutputStream.write(SoapUILoggingOutputStream.java:41)
   	at org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:126)
   	at org.apache.http.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:138)
   	at org.apache.http.impl.io.SessionOutputBufferImpl.flush(SessionOutputBufferImpl.java:146)
   	at org.apache.http.impl.BHttpConnectionBase.doFlush(BHttpConnectionBase.java:177)
   	at org.apache.http.impl.DefaultBHttpClientConnection.flush(DefaultBHttpClientConnection.java:185)
   	at org.apache.http.impl.conn.CPoolProxy.flush(CPoolProxy.java:177)
   	at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:240)
   	at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$SoapUIHttpRequestExecutor.doSendRequest(HttpClientSupport.java:498)
   	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:122)
   	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
   	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
   	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
   	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
   	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
   	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
   	at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$SoapUIHttpClient.doExecute(HttpClientSupport.java:248)
   	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
   	at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$Helper.execute(HttpClientSupport.java:593)
   	at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport.execute(HttpClientSupport.java:661)
   	at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.submitRequest(HttpClientRequestTransport.java:332)
   	at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:249)
   	at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:130)
   	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
   	at java.util.concurrent.FutureTask.run(Unknown Source)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   	at java.lang.Thread.run(Unknown Source)

Above are the errors, I'm receiving every-time.  

  • MarcusJ's avatar
    MarcusJ
    4 years ago

    Hi,

     

    Are you using an IP address instead of a hostname in your requests in ReadyAPI?  If so, please use a hostname instead.  

     

    Regards,

    Marcus James

    SmartBear Support

6 Replies

  • richie's avatar
    richie
    Community Hero
    Hi arunbharath,

    Unfortunately the error response doesnt really tell us much other thsn the http connection was reset.

    Connection reset response would typically be cos of the remote endpoint youre hitting and nothing to do with ReadyAPI!

    Is there anything that makes you think ReadyAPI! is causing your endpoint to kill the socket?

    Could your endpoint be killing the connection cos youre hammering it with ReadyAPI!?

    Have you any more data to go on than this?
    Can you check the logging on the endpoint youre hitting? There might be some indication why the connection is reset.

    Ta

    Rich
    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thank you Richie, great troubleshooting ideas.

       

      arunbharath was the issue solved for you? If not, please provide the Community with more info.

    • arunbharath's avatar
      arunbharath
      Contributor

      Sorry for late reply. Before trying your approach, I updated my ReadyAPI to 3.2.5. But Unfortunately after my upgrade none of my test case is running. I'm getting below exception

       

      Wed May 13 14:39:08 UTC 2020: ERROR: Exception in request: javax.net.ssl.SSLException: Couldn't kickstart handshaking
      Wed May 13 14:39:08 UTC 2020: ERROR: An error occurred [Couldn't kickstart handshaking], see error log for details

       

      Wed May 13 14:39:08 UTC 2020: ERROR: javax.net.ssl.SSLException: Couldn't kickstart handshaking
         javax.net.ssl.SSLException: Couldn't kickstart handshaking
         	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:127)
         	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:320)
         	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263)
         	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:405)
         	at java.base/sun.security.ssl.SSLSocketImpl.ensureNegotiated(SSLSocketImpl.java:721)
         	at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:998)
         	at com.eviware.soapui.impl.wsdl.support.http.SoapUILoggingOutputStream.write(SoapUILoggingOutputStream.java:41)
         	at org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:126)
         	at org.apache.http.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:138)
         	at org.apache.http.impl.io.SessionOutputBufferImpl.flush(SessionOutputBufferImpl.java:146)
         	at org.apache.http.impl.io.ContentLengthOutputStream.flush(ContentLengthOutputStream.java:101)
         	at org.apache.http.entity.ByteArrayEntity.writeTo(ByteArrayEntity.java:117)
         	at org.apache.http.impl.DefaultBHttpClientConnection.sendRequestEntity(DefaultBHttpClientConnection.java:158)
         	at org.apache.http.impl.conn.CPoolProxy.sendRequestEntity(CPoolProxy.java:162)
         	at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:237)
         	at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$SoapUIHttpRequestExecutor.doSendRequest(HttpClientSupport.java:504)
         	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:122)
         	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
         	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
         	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
         	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
         	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
         	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
         	at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$SoapUIHttpClient.doExecute(HttpClientSupport.java:250)
         	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
         	at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$Helper.execute(HttpClientSupport.java:631)
         	at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport.execute(HttpClientSupport.java:605)
         	at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.submitRequest(HttpClientRequestTransport.java:337)
         	at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:254)
         	at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:130)
         	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
         	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
         	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
         	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
         	at java.base/java.lang.Thread.run(Thread.java:835)
         	Suppressed: java.net.SocketException: Connection reset by peer: socket write error
         		at java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
         		at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110)
         		at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
         		at java.base/sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:81)
         		at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:351)
         		... 33 more
         Caused by: java.net.SocketException: Connection reset by peer: socket write error
         	at java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
         	at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110)
         	at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
         	at java.base/sun.security.ssl.SSLSocketOutputRecord.flush(SSLSocketOutputRecord.java:251)
         	at java.base/sun.security.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:89)
         	at java.base/sun.security.ssl.ClientHello$ClientHelloKickstartProducer.produce(ClientHello.java:658)
         	at java.base/sun.security.ssl.SSLHandshake.kickstart(SSLHandshake.java:515)
         	at java.base/sun.security.ssl.ClientHandshakeContext.kickstart(ClientHandshakeContext.java:107)
         	at java.base/sun.security.ssl.TransportContext.kickstart(TransportContext.java:227)
         	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:395)
         	... 31 more
      • MarcusJ's avatar
        MarcusJ
        Moderator

        Hi,

         

        Are you using an IP address instead of a hostname in your requests in ReadyAPI?  If so, please use a hostname instead.  

         

        Regards,

        Marcus James

        SmartBear Support

  • HI  I am having the same issue, I have to hit the endpoint 3-4 times in ReadyAPI in order to get a successful response. However, if I use the actual UI (Mobile app) to hit the exact same endpoint it works every time.  (i.e service automation fails but UI automation pass for the same endpoint).   We are using hostname and not an IP , Thus the solution provided here don't fix the issue. We are using  Licensed ReadyAPI 3.3.0 . 

     

     

    Sat Oct 03 16:06:49 EDT 2020: ERROR: javax.net.ssl.SSLException: Connection reset
    javax.net.ssl.SSLException: Connection reset
    at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:127)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:320)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:258)
    at java.base/sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1342)
    at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:844)
    at com.eviware.soapui.impl.wsdl.support.http.SoapUILoggingInputStream.read(SoapUILoggingInputStream.java:53)
    at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:139)
    at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:155)
    at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:284)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
    at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
    at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
    at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$SoapUIHttpRequestExecutor.doReceiveResponse(HttpClientSupport.java:531)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
    at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$SoapUIHttpClient.doExecute(HttpClientSupport.java:250)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$Helper.execute(HttpClientSupport.java:631)
    at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport.execute(HttpClientSupport.java:605)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.submitRequest(HttpClientRequestTransport.java:337)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:254)
    at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:130)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:835)
    Suppressed: java.net.SocketException: Connection reset by peer: socket write error
    at java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110)
    at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
    at java.base/sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:81)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:351)
    ... 33 more
    Caused by: java.net.SocketException: Connection reset
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186)
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
    at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:448)
    at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:68)
    at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1132)
    at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:828)
    ... 29 more