title: RESTIFY: Error: socket hang up] code: 'ECONNRESET' on multiple requests
body: <p>I am implementing a node app, which brings in order details from BigCommerce.
  Multiple calls are made to BigCommerce API asynchronously using Restify JsonClient.</p>
  
  <p>It works fine for some calls but after that i gives error:  <code>[Error: socket hang up] code: 'ECONNRESET', sslError: undefined, body: {}</code>  </p>
  
  <p>I have tried turning off socket pooling ie by setting <code>agent=false</code>, but it still gives same error.</p>
  
  <p>Following is code which makes call to BigCommerce API</p>
  
  <pre><code>makeRequest = function (url, params, headers, orderDetails, cb) {
                  var options = {
                headers: headers
                };
  
                  var client = restify.createJsonClient({
                      url: url
                  });
  
                  client.get(options, function(err, req, res, obj) {
                      if(err){
                          console.log(err);
                          cb(err,obj);
                      } else if(obj != null) {
                          var result = obj;
                          if(orderDetails == null) {
                              cb(null,result);
                          } else {
                              cb(null, result , orderDetails);
                          }
                      }
                  });
              };
  </code></pre>
  
  <p>I get following error:</p>
  
  <pre><code>{ [Error: socket hang up] code: 'ECONNRESET', sslError: unde
  fined, body: {} } Error: socket hang up
      at SecurePair.error (tls.js:993:23)
      at EncryptedStream.CryptoStream._done (tls.js:689:22)
      at CleartextStream.read [as _read] (tls.js:490:24)
      at CleartextStream.Readable.read (_stream_readable.js:320:10)
      at EncryptedStream.onCryptoStreamFinish (tls.js:301:47)
      at EncryptedStream.g (events.js:175:14)
      at EncryptedStream.EventEmitter.emit (events.js:117:20)
      at finishMaybe (_stream_writable.js:352:12)
      at endWritable (_stream_writable.js:359:3)
      at EncryptedStream.Writable.end (_stream_writable.js:337:5)
      at EncryptedStream.CryptoStream.end (tls.js:628:31)
      at Socket.onend (_stream_readable.js:483:10) 
  </code></pre>
  
  <p>Why am i getting such error? How can i handle it?</p>
  
  <p>Thanks</p>