Unable to send request (Root cause: java.net.SocketException: Socket closed

When sending API requests through the Web/API service, I’m able to send around 70 without issue. The data values are being read from a CSV file. However, after those 70, I receive the error:

Unable to send request (Root cause: java.net.SocketException: Socket closed

For each request.

The original 60+ request go through each run without incident. I was able to use the Postman Runner and sent 100 tests to the same API without incident. Each test was a pass with no failures.

The code used is based on the following example:
Create REST API requests manually

2019-04-01 14:53:52.384 DEBUG testcase.Postman Request                 - 5: resp = req.buildPostApiRequestDataDriven(order_id, customer_number, branch_number, tier_code, unit_measure)
2019-04-01 14:53:52.388 INFO  c.k.k.core.util.BrowserMobProxyManager   - HAR: /Users/<>/Katalon Studio/Postman Testing/Reports/Postman Data Driven/20190401_145129/requests/main/78.har
2019-04-01 14:53:52.389 ERROR c.k.k.core.keyword.internal.KeywordMain  - ❌ Unable to send request (Root cause: java.net.SocketException: Socket closed
	at com.kms.katalon.core.webservice.common.RestfulClient.sendRequest(RestfulClient.java:80)
	at com.kms.katalon.core.webservice.common.RestfulClient.send(RestfulClient.java:49)
	at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword$_sendRequest_closure1.doCall(SendRequestKeyword.groovy:53)
	at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword$_sendRequest_closure1.call(SendRequestKeyword.groovy)
	at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:66)
	at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword.sendRequest(SendRequestKeyword.groovy:48)
	at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword.execute(SendRequestKeyword.groovy:43)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords.sendRequest(WSBuiltInKeywords.groovy:40)
	at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords$sendRequest.call(Unknown Source)
	at mypackage.SampleRequestObject.buildPostApiRequestDataDriven(SampleRequestObject.groovy:110)
1 Like

To add more information to this issue, it appears to be a problem with the “data driven” portion of the test.

For example, if I use the following code, I can send 100 requests without issue.

List userName=['','Liam','Noah','William','James'] //<-- 100 names goes here
def slurper = new JsonSlurper()

for (loop = 1; loop <=userName.size()-1; loop++) {
	response1 = WS.sendRequest(findTestObject('eComm', [('name') : userName[loop]]))
	String result = slurper.parseText(response1.getResponseBodyContent())
	log.logWarning("API Response #" + loop + ": ---> " + result) 

If I use the same code, but set it up with a Test Suite with a CSV or XLS file of 100 names, it fails at 70 requests every time.

def slurper = new JsonSlurper()
response1 = WS.sendRequest(findTestObject('eComm', [('name') : firstName]))
String result = slurper.parseText(response1.getResponseBodyContent())
log.logWarning("API Response #: ---> " + result)

For this simple example, I have a Web Service Request object pointing to:

1 Like

Just to add, this also works using an XLS spreadsheet.

def slurper = new JsonSlurper()

FileInputStream file = new FileInputStream ("//location//100names.xlsx")
XSSFWorkbook workbook = new XSSFWorkbook(file);
XSSFSheet sheet = workbook.getSheetAt(0);

'Read data from excel'
for (loop = 1; loop <=100; loop++) {
	String Data_fromCell=sheet.getRow(loop).getCell(0).getStringCellValue();
	response1 = WS.sendRequest(findTestObject('eComm', [('name') : Data_fromCell]))
	String result = slurper.parseText(response1.getResponseBodyContent())
	log.logWarning("API Response #" + loop + ": ---> " + result)


From everything I have tried, the process of using a “data driven” file from the Test Suite sheet causes the issue.

@Katalon_team Can someone have a look and give some advice on this?


Thank you for the report. We are working on it.

1 Like

Hi Alex, can u pls help to give some update on this one?


Disabling the Browser MobProxy option resolved this issue for me: http://forum.katalon.com/t/5-9-0-getting-a-java-net-socketexception-permission-denied-connect-after-update/14500


here are several possible causes.

The other end has deliberately reset the connection. It is rare, and generally incorrect, for application software to do this, but it is not unknown for commercial software.

More commonly, it is caused by writing to a connection that the other end has already closed normally. In other words an application protocol error.

It can also be caused by closing a socket when there is unread data in the socket receive buffer.

In Windows, ‘software caused connection abort’, which is not the same as ‘connection reset’, is caused by network problems sending from your end. There’s a Microsoft knowledge base article about this.

More about….Socket Programming

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.


we got the issue too, but unable to find how to disabling Browser MobProxy in katalon version 6.3.3


We don’t use BrowserMob to generate HAR files anymore. So if you are using 6.3.3, please submit your issue in a new topic.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.