# Socket closed error

**URL:** <https://community.postman.com/t/socket-closed-error/22353>\
**Category:** Help Hub\
**Tags:** newman-project, tests, variables, api\
**Created:** [April 7, 2021, 4:40pm UTC](https://community.postman.com/t/socket-closed-error/22353 "2021-04-07T16:40:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sonawanesarvesh](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@sonawanesarvesh](https://community.postman.com/u/sonawanesarvesh)\
**Post date:** [April 7, 2021, 4:40pm UTC](https://community.postman.com/t/socket-closed-error/22353/1 "2021-04-07T16:40:30Z")

</div>

Hello  
I am using newman library with following code  
i am getting error [errored] Socket closed

const newman = require(‘newman’);  
const SocksProxyAgent = require(‘socks-proxy-agent’);  
const requestAgent = new SocksProxyAgent({ host: ‘localhost’, port: ‘8080’ });

const pathtocheck = ‘/zapApiPostmanCollection.json’;  
console.log(pathtocheck);  
newman.run({  
collection: pathtocheck,  
requestAgents: {  
http: requestAgent, // agent used for HTTP requests  
https: requestAgent, // agent used for HTTPS requests  
},  
insecure:‘true’,  
reporters: ‘cli’  
},function (err) {  
if (err) { throw err; }  
console.log(‘collection run complete!’);

```
	});

```

---

<div class="post-metadata">

**Author:** ![sean.keegan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/sean.keegan/32/6353_2.png) [@sean.keegan](https://community.postman.com/u/sean.keegan)\
**Post date:** [April 7, 2021, 5:07pm UTC](https://community.postman.com/t/socket-closed-error/22353/2 "2021-04-07T17:07:05Z")

</div>

Hi @sonawanesarvesh! Welcome to the community! 🏆 Let’s see if we can get you some help 🙂

It may help to provide a bit more context and information on the issue you’re having. Can you please check out [these guidelines](https://community.postman.com/t/how-to-best-ask-questions-on-community-to-get-the-answers-you-need/16912) on how to ask questions here on the forum? A clear question will go a long way to getting your problem solved, even just for readability’s sake.

---

<div class="post-metadata">

**Author:** ![sonawanesarvesh](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@sonawanesarvesh](https://community.postman.com/u/sonawanesarvesh)\
**Post date:** [April 7, 2021, 5:13pm UTC](https://community.postman.com/t/socket-closed-error/22353/3 "2021-04-07T17:13:08Z")

</div>

@sean.keegan thank you for quick reply - i searched but i did not find any reference for the Socket Closed issue so thought to ask

my real problem is  
i am getting **Socket Closed** error for following code  
but this 0.0.0.0:8090 is used by other process easily so socket is open for sure

`const newman = require(‘newman’);  
const SocksProxyAgent = require(‘socks-proxy-agent’);  
const requestAgent = new SocksProxyAgent({ host: ‘0.0.0.0’, port: ‘8090’ });

const pathtocheck = ‘/zapApiPostmanCollection.json’;  
console.log(pathtocheck);  
newman.run({  
collection: pathtocheck,  
requestAgents: {  
http: requestAgent, // agent used for HTTP requests  
https: requestAgent, // agent used for HTTPS requests  
},  
insecure:‘true’,  
reporters: ‘cli’  
},function (err) {  
if (err) { throw err; }  
console.log(‘collection run complete!’);

---

<div class="post-metadata">

**Author:** ![sonawanesarvesh](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@sonawanesarvesh](https://community.postman.com/u/sonawanesarvesh)\
**Post date:** [April 7, 2021, 5:40pm UTC](https://community.postman.com/t/socket-closed-error/22353/4 "2021-04-07T17:40:30Z")

</div>

Just update - i am running it inside Ubuntu Docker, thats why my proxy is running at 0.0.0.0:8090
