Service Virtualization

Expand all | Collapse all

Getting socket timeout exception on running rest request in devtest

Jump to Best Answer
  • 1.  Getting socket timeout exception on running rest request in devtest

    Posted 08-01-2017 08:04 AM

    I am getting socket timeout exception on running rest request on devtest.

     

     

    But when i am running the same request on web browser or soap ui . i am getting proper response.

     

    belowi s the sample request

    https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=XXXXX

     

    sometimes i am also getting error like Scheme https is not registered.

    Please help me on this.



  • 2.  Re: Getting socket timeout exception on running rest request in devtest

    Broadcom Employee
    Posted 08-01-2017 11:12 AM

    Please look into your workstation.log for error log related to this and share the same.

     

    Thanks,

    Surya.



  • 3.  Re: Getting socket timeout exception on running rest request in devtest

    Broadcom Employee
    Posted 08-01-2017 11:50 AM

    Can you try using the HTTP/HTML Request step & see if you are able to connect.

     



  • 4.  Re: Getting socket timeout exception on running rest request in devtest

    Posted 08-01-2017 01:13 PM

    Hi Prem/suru,

     

    tried with HTTP request step still getting same error.

     

    in workstation log getting below exception

     

    | HTTP
    ============================================================================
    | Message: java.net.SocketTimeoutException: connect timed out
    ----------------------------------------------------------------------------
    | Trapped Exception: connect timed out
    | Trapped Message: java.net.SocketTimeoutException: connect timed out
    ----------------------------------------------------------------------------
    STACK TRACE
    java.net.SocketTimeoutException: connect timed out
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:524)
    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:1015)
    at com.itko.lisa.test.CommTrans.send(CommTrans.java:811)
    at com.itko.lisa.test.CommTrans.sendGET(CommTrans.java:758)
    at com.itko.lisa.test.URLTrans.doSend(URLTrans.java:280)
    at com.itko.lisa.test.URLTrans.doWebTrans(URLTrans.java:222)
    at com.itko.lisa.test.URLTransBase.execute(URLTransBase.java:491)
    at com.itko.lisa.editor.URLTransEditor$3$1.run(URLTransEditor.java:249)
    ============================================================================


    2017-08-01 17:09:44,509Z (22:39) [Thread-100] INFO com.itko.lisa.test.TestNode - Raising EVENT_ERROR
    2017-08-01 17:09:57,494Z (22:39) [AWT-EventQueue-0] INFO com.itko.lisa.test.Environment - SSL: uninstalled CustomClientSSLScheme
    2017-08-01 17:10:20,241Z (22:40) [AWT-EventQueue-0] INFO System.out - QuickSearch$QuickSearchPainter.hideSearch
    2017-08-01 17:10:37,598Z (22:40) [JavaFX Application Thread] INFO com.itko.lisa.test.Environment - SSL: installCustomClientSSLScheme



  • 5.  Re: Getting socket timeout exception on running rest request in devtest
    Best Answer

    Broadcom Employee
    Posted 08-01-2017 01:32 PM

    Is your browser using any proxy setting to connect to the internet. If so you will need to configure the same using the following properties in your local.properties file

     

    lisa.http.webProxy.host

    lisa.http.webProxy.port

     

    lisa.http.webProxy.ssl.host

    lisa.http.webProxy.ssl.port



  • 6.  Re: Getting socket timeout exception on running rest request in devtest

    Broadcom Employee
    Posted 08-01-2017 01:35 PM

    You can also try adding a companion to the test case :  Common -> Configure DevTest to Use a Web Proxy. 



  • 7.  Re: Getting socket timeout exception on running rest request in devtest

    Posted 08-01-2017 02:12 PM

    my browser is not using proxy settings. Automatic configuration is selected



  • 8.  Re: Getting socket timeout exception on running rest request in devtest

    Broadcom Employee
    Posted 08-01-2017 02:32 PM

    If I understand correctly - your browser is set to "Use Automatic Configuration script" - this is a configuration file which defines what proxy server to use when connecting to different URL.

     

    You should be able to save this file using a browser & check what rules your organization has set. Alternatively ask someone in your network team who can provide this information



  • 9.  Re: Getting socket timeout exception on running rest request in devtest

    Posted 08-01-2017 02:56 PM

    But i have one question. same request ons ame machine is working on SOAP UI and also on google chrome.



  • 10.  Re: Getting socket timeout exception on running rest request in devtest

    Broadcom Employee
    Posted 08-01-2017 03:57 PM

    Google Chrome will use the "Use Automatic Configuration script. I don't know how your SOAP UI is setup but I believe it too tries to automatically find out the proxy server details from browser/OS settings.

     

    With DevTest you need to either set it up using the properties mentioned above or use the Companion mentioned by Surya above - for which you will need to know the Proxy server details



  • 11.  Re: Getting socket timeout exception on running rest request in devtest

    Broadcom Employee
    Posted 08-01-2017 04:29 PM

    Can you please check what is the output of the following in Chrome browser (the following needs to be copied in the address bar)

     

    chrome://net-internals/#proxy

     

    You may also get some information if you use

     

    http://www.whatismyproxy.com/

     

    Please post what you find (after removing any confidential information)



  • 12.  Re: Getting socket timeout exception on running rest request in devtest

    Posted 08-02-2017 08:04 AM

    changing proxy in properties file worked. Thanks

     

    But after changing it i am not able to connect to my workstation using local registry getting authentication error. and once i removed proxy was able to connect to my workstation using local registry. can you please tell me what might be the issue.

     

    Also if possible how to use the Companion mentioned.



  • 13.  Re: Getting socket timeout exception on running rest request in devtest

    Broadcom Employee
    Posted 08-02-2017 09:38 AM

    This may be because your local calls are also going through the proxy. In the proxy settings, you can set the non Proxy hosts using the property - lisa.http.webProxy.nonProxyHosts, which will help you bypass proxy for local calls. To add companion, refer the link below..

    Add a Companion - DevTest Solutions - 8.4 - CA Technologies Documentation 

    It will look something like the below image and you can fill in the proxy details. You can select Exclude Simple Hostnames to bypass proxy for local server calls. 

     



  • 14.  Re: Getting socket timeout exception on running rest request in devtest

    Posted 08-01-2017 01:17 PM

    Hi,

        I trired the same api,I am getting the response in DevTest. Can you check if there is any firewall blocking the request.GoogleAPIResponse

                                                   Thanks,

    Regards,

    Vish