Service Virtualization

 View Only
Expand all | Collapse all

Mule Soft endpoint for REST API call with SSL certificate - java.net.SocketException: Connection reset by peer: socket write error

  • 1.  Mule Soft endpoint for REST API call with SSL certificate - java.net.SocketException: Connection reset by peer: socket write error

    Posted Nov 16, 2023 08:44 AM

    Hi Team , 

    Our project is using Mulesoft Endpoint for the REST API calls. I am using SSL certificate, for which I have mentioned the details in the local.properties file in my workstation.

    ssl.client.cert.path=C:\\Users\\12345\\DevTest\\Projects\\samplecert.com.pfx
    ssl.client.cert.pass=password
    https.protocols=TLSv1.2,TLSv1.1,TLSv1

    lisa.net.trustStore=C:\\Users\\12345\\DevTest\\Projects\\samplecert.com.jks
    lisa.net.trustStore.password=password

    Note : Same password is used for the .pfx and .jks file. 

    When I try to run the sample test case in ITR mode, I get the below error . Please let me know what can be done to fix this.

    ============================================================================
    | HTTP
    ============================================================================
    | Step:        AddCustomer
    ----------------------------------------------------------------------------
    | Message:     java.net.SocketException: Connection reset by peer: socket write error
    ----------------------------------------------------------------------------
    | Trapped Exception: Connection reset by peer: socket write error
    | Trapped Message:   java.net.SocketException: Connection reset by peer: socket write error
    ----------------------------------------------------------------------------
    STACK TRACE
    java.net.SocketException: Connection reset by peer: socket write error
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
        at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431)
        at sun.security.ssl.OutputRecord.write(OutputRecord.java:417)
        at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:879)
        at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:850)
        at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:720)
        at sun.security.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:1144)
        at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:1333)
        at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1243)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:373)
        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
        at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
        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:1082)
        at com.itko.lisa.test.CommTrans.send(CommTrans.java:851)
        at com.itko.lisa.test.CommTrans.sendPOST(CommTrans.java:811)
        at com.itko.lisa.ws.rest.RESTNode.doSend(RESTNode.java:226)
        at com.itko.lisa.ws.rest.RESTNode.doWebTrans(RESTNode.java:171)
        at com.itko.lisa.ws.rest.RESTNodeBase.execute(RESTNodeBase.java:380)
        at com.itko.lisa.test.TestNode.executeNode(TestNode.java:995)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1297)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1198)
        at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1183)
        at com.itko.lisa.utils.ExecSubProcessNode.doFullExec(ExecSubProcessNode.java:354)
        at com.itko.lisa.utils.ExecSubProcessNode.execute(ExecSubProcessNode.java:268)
        at com.itko.lisa.test.TestNode.executeNode(TestNode.java:995)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1297)
        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:1120)
        at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:73)
        at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:1022)
        at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:195)
        at java.lang.Thread.run(Thread.java:748)
    ============================================================================



    ------------------------------
    Shalini Murukes
    ------------------------------