title: What causes amqp.node to get ECONNRESET from a RabbitMQ server?
body: <p>I have an instance of RabbitMQ (default configurations) running on Windows 8 environment. My node version is 5.1.0 and I am trying to establish a connection between them using <a href="https://github.com/squaremo/amqp.node" rel="nofollow">amqp.node</a> library in order to pass messages.</p>
  
  <p>When I try the sample code:</p>
  
  <pre><code>var q = 'tasks';
  
  function bail(err) {
    console.error(err);
    process.exit(1);
  }
  
  // Publisher
  function publisher(conn) {
    conn.createChannel(on_open);
    function on_open(err, ch) {
      if (err != null) bail(err);
      ch.assertQueue(q);
      ch.sendToQueue(q, new Buffer('something to do'));
    }
  }
  
  // Consumer
  function consumer(conn) {
    var ok = conn.createChannel(on_open);
    function on_open(err, ch) {
      if (err != null) bail(err);
      ch.assertQueue(q);
      ch.consume(q, function(msg) {
        if (msg !== null) {
          console.log(msg.content.toString());
          ch.ack(msg);
        }
      });
    }
  }
  
  require('amqplib/callback_api')
    .connect('amqp://guest:guest@localhost:5672', function(err, conn) {
      if (err != null) bail(err);
      consumer(conn);
      publisher(conn);        
    });
  </code></pre>
  
  <p>I get it working okay.</p>
  
  <p>But if I move this code, exactly how it is, into my project, I get this error: </p>
  
  <p><strong>ECCONRESET syscall: read.</strong></p>
  
  <p>My app runs with express.js and oauth2.0. Even if I put the code right before any other statements and modules' requires, it does not work.</p>
  
  <p>I searched about this error and I found some problems related to load balance, but I am running it locally and the sample code works okay.</p>
  
  <p>Another problem that I found could be related to TCP connection, I changed the handshake timout option inside RabbitMQ server's config file to 10000ms, but nothing changed.</p>
  
  <p>I am using the same url with guest user: amqp://guest:guest@localhost:5672, which works on the sample code.</p>
  
  <p>The log from RabbitMQ shows that a connection is done but a few seconds later, it states that the connection was closed unexpectedly: </p>
  
  <pre><code>=INFO REPORT==== 24-Nov-2015::18:09:52 ===
  accepting AMQP connection &lt;0.2644.0&gt; (127.0.0.1:51866 -&gt; 127.0.0.1:5672)
  
  =ERROR REPORT==== 24-Nov-2015::18:10:12 ===
  closing AMQP connection &lt;0.2644.0&gt; (127.0.0.1:51866 -&gt; 127.0.0.1:5672):
  {handshake_timeout,frame_header}
  </code></pre>
  
  <p>So my questions are: is there any conflict between amqp.node and other library that drops the connection with the server? How can I debug this?</p>