[API]-[Exception]-[KeywordMain] Unable to send request (Root cause: java.net.SocketException: Socket closed)


See the image: I got above error when trying to send a RestAPI request.
Since this error is from KeywordMain of Katalon, can someone please give an idea for resolving it…

Phuong Hua.

were you able to run the test using the play button in object repository?

Hi Manu,

See the attachment, that is the way I am sending a request.

In my case, I am taking test data from excel file.
I have 85 test data records, and for the first 76 test records, everything is OK.
I just got the issue from the record 77th to the last one.
Also, If I only run test data of record 77th → the latest record (9 rows of data in excel file), there is NO Socket error issue.

I am not sure but It looks like that there is some issue with Katalon if the number of test data in excel file is more than 70 rows…

Do you have any advice on this?


strange issue. No explanation

i had this issue when i run test data from excel file after records 180+.

I am running into this as well, right at the same 77 number by the look of it.
It’s a data driven test reading data from a CSV file. The first 70 requests go through without issue.
Once it hits this ~77 item, it gets the same error:

(Root cause: java.net.SocketException: Socket closed)

While not 100% the same, I made a Postman Runner, for that single test and was able to send it 100 times without issue. The problem appears to be within Katalon and a certain threshold for the number of tests it can send, not with the API itself.

1 Like

I recreated my test to use a POST request from the Object Repository. I have again set this up as a Data Driven test using a CSV file with 100 items. It consistently fails after processing 70 items with the same Socket Closed error.

Is there something within this process that is actually opening 70 sockets?
Is there some additional piece needed to clean up after each API request?

response1 = WS.sendRequestAndVerify(findTestObject('Pricing Request', [('customer_number') : customer_number, ('branch_number') : branch_number
            , ('tier_code') : tier_code, ('unit') : unit]))

def slurper = new JsonSlurper()

def result = slurper.parseText(response1.getResponseBodyContent())

String value = result.pricing.tiers[0].price

log.logWarning('Item Price: ' + value)

This worked for me: http://forum.katalon.com/t/5-9-0-getting-a-java-net-socketexception-permission-denied-connect-after-update/14500

Thank you all for the support.

Since the answer from Justin just solved my problem, I currently mark this one as the correct answer.

Hope any one who got the same issue can find out the solution. :smile: