Service Virtualization

  • 1.  SSL Handshake exception while recording a https REST API

    Posted Nov 23, 2016 04:13 AM

    Hi All,

     

    I am using DevTest 9.0.0 & trying to record https REST API from LISA testcase. While testing API is working fine, however when I am trying to record the transaction, its showing SSL handshake exception. can anybody please help me here to understand as to what's going wrong?

    Thanks in advance!



  • 2.  Re: SSL Handshake exception while recording a https REST API

    Posted Nov 23, 2016 11:50 AM

    Hello Sonakshi,

     

    What is the exception you are facing? How is the VSE recorder configured? If you have screenshots, please attach it here.

    Is the target system configured for 1 or 2-way SSL authentication?

     

    Thank you,

    Heloisa



  • 3.  Re: SSL Handshake exception while recording a https REST API

    Posted Nov 24, 2016 03:52 AM

    Hi Heloisa,

    Please find below the Exception being thrown:

     

    ============================================================================
    | HTTP
    ============================================================================
    | Step: https
    ----------------------------------------------------------------------------
    | Message: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    ----------------------------------------------------------------------------
    | Trapped Exception: Remote host closed connection during handshake
    | Trapped Message: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    ----------------------------------------------------------------------------
    STACK TRACE
    javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:535)
    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:403)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
    at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
    at com.itko.lisa.test.CommTrans.doSend(CommTrans.java:1025)
    at com.itko.lisa.test.CommTrans.send(CommTrans.java:814)
    at com.itko.lisa.test.CommTrans.sendGET(CommTrans.java:767)
    at com.itko.lisa.ws.rest.RESTNode.doSend(RESTNode.java:209)
    at com.itko.lisa.ws.rest.RESTNode.doWebTrans(RESTNode.java:168)
    at com.itko.lisa.ws.rest.RESTNodeBase.execute(RESTNodeBase.java:362)
    at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1283)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1198)
    at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1183)
    at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1050)
    at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:70)
    at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:963)
    at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.EOFException: SSL peer shut down incorrectly
    at sun.security.ssl.InputRecord.read(Unknown Source)
    ... 27 more
    ============================================================================

     

    Also, recorder is configured in one way SSL(use SSL to server) configuration as the target API is https & is provided with SSL keystore file (ssl.client.cert.path) & password.

    Please suggest.



  • 4.  Re: SSL Handshake exception while recording a https REST API

    Posted Nov 24, 2016 06:11 AM

    Also, I am not even able to record HTTP API as well. I have configured the recorder, but not getting recordings instead getting below error for "HTTP":

     

    ============================================================================ | HTTP ============================================================================ | Step: http GET /maps/api/geocode/xml ---------------------------------------------------------------------------- | Message: org.apache.http.NoHttpResponseException: localhost:8026 failed to respond ---------------------------------------------------------------------------- | Trapped Exception: localhost:8026 failed to respond | Trapped Message: org.apache.http.NoHttpResponseException: localhost:8026 failed to respond ---------------------------------------------------------------------------- STACK TRACE org.apache.http.NoHttpResponseException: localhost:8026 failed to respond at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260) at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:283) at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:251) at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:197) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123) at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:685) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:487) at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) at com.itko.lisa.test.CommTrans.doSend(CommTrans.java:1025) at com.itko.lisa.test.CommTrans.send(CommTrans.java:814) at com.itko.lisa.test.CommTrans.sendGET(CommTrans.java:767) at com.itko.lisa.ws.rest.RESTNode.doSend(RESTNode.java:209) at com.itko.lisa.ws.rest.RESTNode.doWebTrans(RESTNode.java:168) at com.itko.lisa.ws.rest.RESTNodeBase.execute(RESTNodeBase.java:362) at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981) at com.itko.lisa.test.TestCase.execute(TestCase.java:1283) at com.itko.lisa.test.TestCase.execute(TestCase.java:1198) at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1183) at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1050) at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:70) at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:963) at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194) at java.lang.Thread.run(Unknown Source) ============================================================================

     

    I am using webproxy host & port values in local.propertie file. set the recorder in proxy mode & got the above response. 

    Please help me understand the underlying issue.

     

    Thanks,

    Sonakshi



  • 5.  Re: SSL Handshake exception while recording a https REST API
    Best Answer

    Posted Nov 28, 2016 05:30 PM

    Hi Sonakshi,

     

    From what you mentioned before, you have a test case that is sending the request to the target system and you are getting a valid response. Is that correct?

    Could you send a screenshot of your VSE Recorder? I would like to verify how you configured the options use SSL to server and use SSL to client.

    If you configured the recorder to Use SSL to Server AND Use SSL to Client you have to send HTTPS request.

    If you configured the recorder to Use SSL to Server only, you will need to send a HTTP request from the client application.

     

    If you have proxy on your environment, between the VSE Recorder (Workstation) and the target system, you will need to set the recorder to use the Proxy pass thru style and configure your client application to use the VSE recorder as your proxy. 

    Here is an example: Configure the VSE Recorder to use Proxy mode style and leave it listening. If you have a test case that is working fine with the target system, add the following companion to this test case: "Configure DevTest to use a Web Proxy". Add the VSE Recorder details to this companion - Web Proxy Host will the hostname or IP address where the VSE recorder is running and Port will be the port which the VSE recorder is listening. Save the test case and run the step in the ITR - the endpoint in the test step needs to be your live system.

    In this case the test case will forward the request to the VSE Recorder that will forward to the live system.

     

    Hope it helps.

    Heloisa



  • 6.  Re: SSL Handshake exception while recording a https REST API

    Posted Nov 28, 2016 11:35 PM

    Hi Heloisa,

     

    Thanks for the assistance:)..its working fine now. Although there was no proxy, I modified the SSL settings as advised by you & updated truststore. Now I am able to record the transactions.

    Thanks again!!



  • 7.  Re: SSL Handshake exception while recording a https REST API

    Posted Nov 30, 2016 11:42 AM

    Good to hear it helped.

    I am marking my previous answer as the correct one.

    Let us know if you do not agree.

     

    Thank you,

    Heloisa



  • 8.  Re: SSL Handshake exception while recording a https REST API

    Posted Mar 29, 2017 06:50 AM

    Thanks Maria for sharing this solution.

    We were struggling to record API in gateway mode.

     

    Adding companion and using proxy style of recording gave us peace of mind