test-double-connect.js 515 B

12345678910111213141516171819202122232425
  1. var common = require('../../common');
  2. var connection = common.createConnection();
  3. var assert = require('assert');
  4. var didConnect = false;
  5. connection.connect(function(err) {
  6. if (err) throw err;
  7. assert.equal(didConnect, false);
  8. didConnect = true;
  9. });
  10. var err;
  11. connection.connect(function(_err) {
  12. err = _err;
  13. });
  14. connection.end();
  15. process.on('exit', function() {
  16. assert.equal(didConnect, true);
  17. assert.equal(err.fatal, false);
  18. assert.equal(err.code, 'PROTOCOL_ENQUEUE_HANDSHAKE_TWICE');
  19. });