amqplib 0.5.1 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.npmignore +0 -1
  2. package/CHANGELOG.md +84 -0
  3. package/Makefile +2 -1
  4. package/README.md +4 -4
  5. package/bin/generate-defs.js +723 -0
  6. package/callback_api.js +1 -0
  7. package/channel_api.js +1 -0
  8. package/examples/headers.js +2 -2
  9. package/examples/receive_generator.js +39 -0
  10. package/examples/send_generators.js +1 -1
  11. package/examples/ssl.js +1 -1
  12. package/examples/tutorials/callback_api/emit_log.js +1 -1
  13. package/examples/tutorials/callback_api/emit_log_direct.js +1 -1
  14. package/examples/tutorials/callback_api/emit_log_topic.js +1 -1
  15. package/examples/tutorials/callback_api/new_task.js +1 -1
  16. package/examples/tutorials/callback_api/rpc_client.js +1 -1
  17. package/examples/tutorials/callback_api/rpc_server.js +1 -1
  18. package/examples/tutorials/callback_api/send.js +1 -1
  19. package/examples/tutorials/emit_log.js +1 -1
  20. package/examples/tutorials/emit_log_direct.js +1 -1
  21. package/examples/tutorials/emit_log_topic.js +1 -1
  22. package/examples/tutorials/new_task.js +1 -1
  23. package/examples/tutorials/rpc_client.js +1 -1
  24. package/examples/tutorials/rpc_server.js +1 -1
  25. package/examples/tutorials/send.js +1 -1
  26. package/examples/waitForConfirms.js +1 -1
  27. package/lib/api_args.js +2 -0
  28. package/lib/channel.js +30 -12
  29. package/lib/codec.js +64 -38
  30. package/lib/connect.js +26 -15
  31. package/lib/connection.js +6 -4
  32. package/lib/credentials.js +20 -3
  33. package/lib/defs.js +203 -75
  34. package/lib/frame.js +2 -1
  35. package/package-lock.json +711 -0
  36. package/package.json +11 -9
  37. package/test/callback_api.js +6 -5
  38. package/test/channel.js +88 -75
  39. package/test/channel_api.js +38 -24
  40. package/test/codec.js +48 -9
  41. package/test/connect.js +88 -3
  42. package/test/connection.js +57 -56
  43. package/test/data.js +32 -9
  44. package/test/frame.js +4 -4
  45. package/test/mux.js +10 -6
  46. package/test/util.js +16 -2
package/package.json CHANGED
@@ -2,30 +2,32 @@
2
2
  "name": "amqplib",
3
3
  "homepage": "http://squaremo.github.io/amqp.node/",
4
4
  "main": "./channel_api.js",
5
- "version": "0.5.1",
5
+ "version": "0.5.5",
6
6
  "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/squaremo/amqp.node.git"
10
10
  },
11
11
  "engines": {
12
- "node": ">=0.8 <6 || ^6"
12
+ "node": ">=0.8 <=12"
13
13
  },
14
14
  "dependencies": {
15
- "bitsyntax": "~0.0.4",
16
- "buffer-more-ints": "0.0.2",
15
+ "bitsyntax": "~0.1.0",
16
+ "bluebird": "^3.5.2",
17
+ "buffer-more-ints": "~1.0.0",
17
18
  "readable-stream": "1.x >=1.1.9",
18
- "bluebird": "^3.4.6"
19
+ "safe-buffer": "~5.1.2",
20
+ "url-parse": "~1.4.3"
19
21
  },
20
22
  "devDependencies": {
21
- "mocha": "~1",
22
23
  "claire": "0.4.1",
23
- "uglify-js": "2.4.x",
24
- "istanbul": "0.1.x"
24
+ "istanbul": "0.1.x",
25
+ "mocha": "^3.5.3",
26
+ "uglify-js": "2.6.x"
25
27
  },
26
28
  "scripts": {
27
29
  "test": "make test",
28
- "prepublish": "make"
30
+ "prepare": "make"
29
31
  },
30
32
  "keywords": [
31
33
  "AMQP",
@@ -8,6 +8,7 @@ var schedule = util.schedule;
8
8
  var randomString = util.randomString;
9
9
  var kCallback = util.kCallback;
10
10
  var domain = require('domain');
11
+ var Buffer = require('safe-buffer').Buffer;
11
12
 
12
13
  var URL = process.env.URL || 'amqp://localhost';
13
14
 
@@ -159,7 +160,7 @@ channel_test('send to queue and consume noAck', function(ch, done) {
159
160
  else done(new Error("message content doesn't match:" +
160
161
  msg + " =/= " + m.content.toString()));
161
162
  }, {noAck: true, exclusive: true});
162
- ch.sendToQueue(q.queue, new Buffer(msg));
163
+ ch.sendToQueue(q.queue, Buffer.from(msg));
163
164
  });
164
165
  });
165
166
 
@@ -175,7 +176,7 @@ channel_test('send to queue and consume ack', function(ch, done) {
175
176
  else done(new Error("message content doesn't match:" +
176
177
  msg + " =/= " + m.content.toString()));
177
178
  }, {noAck: false, exclusive: true});
178
- ch.sendToQueue(q.queue, new Buffer(msg));
179
+ ch.sendToQueue(q.queue, Buffer.from(msg));
179
180
  });
180
181
  });
181
182
 
@@ -183,7 +184,7 @@ channel_test('send to and get from queue', function(ch, done) {
183
184
  ch.assertQueue('', {exclusive: true}, function(e, q) {
184
185
  if (e != null) return done(e);
185
186
  var msg = randomString();
186
- ch.sendToQueue(q.queue, new Buffer(msg));
187
+ ch.sendToQueue(q.queue, Buffer.from(msg));
187
188
  waitForMessages(ch, q.queue, function(e, _) {
188
189
  if (e != null) return done(e);
189
190
  ch.get(q.queue, {noAck: true}, function(e, m) {
@@ -210,12 +211,12 @@ confirm_channel_test('Receive confirmation', function(ch, done) {
210
211
  // An unroutable message, on the basis that you're not allowed a
211
212
  // queue with an empty name, and you can't make bindings to the
212
213
  // default exchange. Tricky eh?
213
- ch.publish('', '', new Buffer('foo'), {}, done);
214
+ ch.publish('', '', Buffer.from('foo'), {}, done);
214
215
  });
215
216
 
216
217
  confirm_channel_test('Wait for confirms', function(ch, done) {
217
218
  for (var i=0; i < 1000; i++) {
218
- ch.publish('', '', new Buffer('foo'), {});
219
+ ch.publish('', '', Buffer.from('foo'), {});
219
220
  }
220
221
  ch.waitForConfirms(done);
221
222
  });
package/test/channel.js CHANGED
@@ -12,6 +12,7 @@ var completes = util.completes;
12
12
  var defs = require('../lib/defs');
13
13
  var conn_handshake = require('./connection').connection_handshake;
14
14
  var OPEN_OPTS = require('./connection').OPEN_OPTS;
15
+ var Buffer = require('safe-buffer').Buffer;
15
16
 
16
17
  var LOG_ERRORS = process.env.LOG_ERRORS;
17
18
 
@@ -29,10 +30,10 @@ function baseChannelTest(client, server) {
29
30
  });
30
31
 
31
32
  pair.server.read(8); // discard the protocol header
32
- var s = util.runServer(pair.server, function(send, await) {
33
- conn_handshake(send, await)
33
+ var s = util.runServer(pair.server, function(send, wait) {
34
+ conn_handshake(send, wait)
34
35
  .then(function() {
35
- server(send, await, bothDone);
36
+ server(send, wait, bothDone);
36
37
  }, fail(bothDone));
37
38
  });
38
39
  };
@@ -45,21 +46,21 @@ function channelTest(client, server) {
45
46
  if (LOG_ERRORS) ch.on('error', console.warn);
46
47
  client(ch, done, conn);
47
48
  },
48
- function(send, await, done) {
49
- channel_handshake(send, await)
49
+ function(send, wait, done) {
50
+ channel_handshake(send, wait)
50
51
  .then(function(ch) {
51
- return server(send, await, done, ch);
52
+ return server(send, wait, done, ch);
52
53
  }).then(null, fail(done)); // so you can return a promise to let
53
54
  // errors bubble out
54
55
  }
55
56
  );
56
57
  };
57
58
 
58
- function channel_handshake(send, await) {
59
- return await(defs.ChannelOpen)()
59
+ function channel_handshake(send, wait) {
60
+ return wait(defs.ChannelOpen)()
60
61
  .then(function(open) {
61
62
  assert.notEqual(0, open.channel);
62
- send(defs.ChannelOpenOk, {channelId: new Buffer('')}, open.channel);
63
+ send(defs.ChannelOpenOk, {channelId: Buffer.from('')}, open.channel);
63
64
  return open.channel;
64
65
  });
65
66
  }
@@ -90,7 +91,7 @@ test("open", channelTest(
90
91
  function(ch, done) {
91
92
  open(ch).then(succeed(done), fail(done));
92
93
  },
93
- function(send, await, done) {
94
+ function(send, wait, done) {
94
95
  done();
95
96
  }));
96
97
 
@@ -99,8 +100,8 @@ test("bad server", baseChannelTest(
99
100
  var ch = new Channel(c);
100
101
  open(ch).then(fail(done), succeed(done));
101
102
  },
102
- function(send, await, done) {
103
- return await(defs.ChannelOpen)()
103
+ function(send, wait, done) {
104
+ return wait(defs.ChannelOpen)()
104
105
  .then(function(open) {
105
106
  send(defs.ChannelCloseOk, {}, open.channel);
106
107
  }).then(succeed(done), fail(done));
@@ -116,8 +117,8 @@ test("open, close", channelTest(
116
117
  })
117
118
  .then(succeed(done), fail(done));
118
119
  },
119
- function(send, await, done, ch) {
120
- return await(defs.ChannelClose)()
120
+ function(send, wait, done, ch) {
121
+ return wait(defs.ChannelClose)()
121
122
  .then(function(close) {
122
123
  send(defs.ChannelCloseOk, {}, ch);
123
124
  }).then(succeed(done), fail(done));
@@ -127,17 +128,19 @@ test("server close", channelTest(
127
128
  function(ch, done) {
128
129
  ch.on('error', function(error) {
129
130
  assert.strictEqual(504, error.code);
131
+ assert.strictEqual(0, error.classId);
132
+ assert.strictEqual(0, error.methodId);
130
133
  succeed(done)();
131
134
  });
132
135
  open(ch);
133
136
  },
134
- function(send, await, done, ch) {
137
+ function(send, wait, done, ch) {
135
138
  send(defs.ChannelClose, {
136
139
  replyText: 'Forced close',
137
140
  replyCode: defs.constants.CHANNEL_ERROR,
138
141
  classId: 0, methodId: 0
139
142
  }, ch);
140
- await(defs.ChannelCloseOk)()
143
+ wait(defs.ChannelCloseOk)()
141
144
  .then(succeed(done), fail(done));
142
145
  }));
143
146
 
@@ -150,8 +153,8 @@ test("overlapping channel/server close", channelTest(
150
153
  ch.closeBecause("Bye", defs.constants.REPLY_SUCCESS);
151
154
  }, fail(both));
152
155
  },
153
- function(send, await, done, ch) {
154
- await(defs.ChannelClose)()
156
+ function(send, wait, done, ch) {
157
+ wait(defs.ChannelClose)()
155
158
  .then(function() {
156
159
  send(defs.ConnectionClose, {
157
160
  replyText: 'Got there first',
@@ -159,7 +162,7 @@ test("overlapping channel/server close", channelTest(
159
162
  classId: 0, methodId: 0
160
163
  }, 0);
161
164
  })
162
- .then(await(defs.ConnectionCloseOk))
165
+ .then(wait(defs.ConnectionCloseOk))
163
166
  .then(succeed(done), fail(done));
164
167
  }));
165
168
 
@@ -173,8 +176,8 @@ test("double close", channelTest(
173
176
  });
174
177
  }).then(succeed(done), fail(done));
175
178
  },
176
- function(send, await, done, ch) {
177
- await(defs.ChannelClose)()
179
+ function(send, wait, done, ch) {
180
+ wait(defs.ChannelClose)()
178
181
  .then(function() {
179
182
  send(defs.ChannelCloseOk, {
180
183
  }, ch);
@@ -207,16 +210,16 @@ test("RPC", channelTest(
207
210
  ch._rpc(defs.BasicQos, fields, defs.BasicQosOk, wheeboom);
208
211
  }).then(null, fail(rpcLatch));
209
212
  },
210
- function(send, await, done, ch) {
213
+ function(send, wait, done, ch) {
211
214
  function sendOk(f) {
212
215
  send(defs.BasicQosOk, {}, ch);
213
216
  }
214
217
 
215
- return await(defs.BasicQos)()
218
+ return wait(defs.BasicQos)()
216
219
  .then(sendOk)
217
- .then(await(defs.BasicQos))
220
+ .then(wait(defs.BasicQos))
218
221
  .then(sendOk)
219
- .then(await(defs.BasicQos))
222
+ .then(wait(defs.BasicQos))
220
223
  .then(sendOk)
221
224
  .then(succeed(done), fail(done));
222
225
  }));
@@ -228,6 +231,8 @@ test("Bad RPC", channelTest(
228
231
  var errLatch = latch(2, done);
229
232
  ch.on('error', function(error) {
230
233
  assert.strictEqual(505, error.code);
234
+ assert.strictEqual(60, error.classId);
235
+ assert.strictEqual(72, error.methodId);
231
236
  succeed(errLatch)();
232
237
  });
233
238
 
@@ -240,12 +245,12 @@ test("Bad RPC", channelTest(
240
245
  });
241
246
  }, fail(errLatch));
242
247
  },
243
- function(send, await, done, ch) {
244
- return await()()
248
+ function(send, wait, done, ch) {
249
+ return wait()()
245
250
  .then(function() {
246
251
  send(defs.BasicGetEmpty, {clusterId: ''}, ch);
247
252
  }) // oh wait! that was wrong! expect a channel close
248
- .then(await(defs.ChannelClose))
253
+ .then(wait(defs.ChannelClose))
249
254
  .then(function() {
250
255
  send(defs.ChannelCloseOk, {}, ch);
251
256
  }).then(succeed(done), fail(done));
@@ -258,6 +263,8 @@ test("RPC on closed channel", channelTest(
258
263
  var close = new Promise(function(resolve) {
259
264
  ch.on('error', function(error) {
260
265
  assert.strictEqual(504, error.code);
266
+ assert.strictEqual(0, error.classId);
267
+ assert.strictEqual(0, error.methodId);
261
268
  resolve();
262
269
  });
263
270
  });
@@ -283,15 +290,15 @@ test("RPC on closed channel", channelTest(
283
290
  .then(succeed(done))
284
291
  .catch(fail(done));
285
292
  },
286
- function(send, await, done, ch) {
287
- await(defs.BasicRecover)()
293
+ function(send, wait, done, ch) {
294
+ wait(defs.BasicRecover)()
288
295
  .then(function() {
289
296
  send(defs.ChannelClose, {
290
297
  replyText: 'Nuh-uh!',
291
298
  replyCode: defs.constants.CHANNEL_ERROR,
292
299
  methodId: 0, classId: 0
293
300
  }, ch);
294
- return await(defs.ChannelCloseOk);
301
+ return wait(defs.ChannelCloseOk);
295
302
  })
296
303
  .then(succeed(done))
297
304
  .catch(fail(done));
@@ -304,14 +311,14 @@ test("publish all < single chunk threshold", channelTest(
304
311
  ch.sendMessage({
305
312
  exchange: 'foo', routingKey: 'bar',
306
313
  mandatory: false, immediate: false, ticket: 0
307
- }, {}, new Buffer('foobar'));
314
+ }, {}, Buffer.from('foobar'));
308
315
  })
309
316
  .then(succeed(done), fail(done));
310
317
  },
311
- function(send, await, done, ch) {
312
- await(defs.BasicPublish)()
313
- .then(await(defs.BasicProperties))
314
- .then(await(undefined)) // content frame
318
+ function(send, wait, done, ch) {
319
+ wait(defs.BasicPublish)()
320
+ .then(wait(defs.BasicProperties))
321
+ .then(wait(undefined)) // content frame
315
322
  .then(function(f) {
316
323
  assert.equal('foobar', f.content.toString());
317
324
  }).then(succeed(done), fail(done));
@@ -324,13 +331,13 @@ test("publish content > single chunk threshold", channelTest(
324
331
  ch.sendMessage({
325
332
  exchange: 'foo', routingKey: 'bar',
326
333
  mandatory: false, immediate: false, ticket: 0
327
- }, {}, new Buffer(3000));
334
+ }, {}, Buffer.alloc(3000));
328
335
  }, done);
329
336
  },
330
- function(send, await, done, ch) {
331
- await(defs.BasicPublish)()
332
- .then(await(defs.BasicProperties))
333
- .then(await(undefined)) // content frame
337
+ function(send, wait, done, ch) {
338
+ wait(defs.BasicPublish)()
339
+ .then(wait(defs.BasicProperties))
340
+ .then(wait(undefined)) // content frame
334
341
  .then(function(f) {
335
342
  assert.equal(3000, f.content.length);
336
343
  }).then(succeed(done), fail(done));
@@ -344,14 +351,14 @@ test("publish method & headers > threshold", channelTest(
344
351
  exchange: 'foo', routingKey: 'bar',
345
352
  mandatory: false, immediate: false, ticket: 0
346
353
  }, {
347
- headers: {foo: new Buffer(3000)}
348
- }, new Buffer('foobar'));
354
+ headers: {foo: Buffer.alloc(3000)}
355
+ }, Buffer.from('foobar'));
349
356
  }, done);
350
357
  },
351
- function(send, await, done, ch) {
352
- await(defs.BasicPublish)()
353
- .then(await(defs.BasicProperties))
354
- .then(await(undefined)) // content frame
358
+ function(send, wait, done, ch) {
359
+ wait(defs.BasicPublish)()
360
+ .then(wait(defs.BasicProperties))
361
+ .then(wait(undefined)) // content frame
355
362
  .then(function(f) {
356
363
  assert.equal('foobar', f.content.toString());
357
364
  }).then(succeed(done), fail(done));
@@ -364,18 +371,18 @@ test("publish zero-length message", channelTest(
364
371
  ch.sendMessage({
365
372
  exchange: 'foo', routingKey: 'bar',
366
373
  mandatory: false, immediate: false, ticket: 0
367
- }, {}, new Buffer(0));
374
+ }, {}, Buffer.alloc(0));
368
375
  ch.sendMessage({
369
376
  exchange: 'foo', routingKey: 'bar',
370
377
  mandatory: false, immediate: false, ticket: 0
371
- }, {}, new Buffer(0));
378
+ }, {}, Buffer.alloc(0));
372
379
  }, done);
373
380
  },
374
- function(send, await, done, ch) {
375
- await(defs.BasicPublish)()
376
- .then(await(defs.BasicProperties))
381
+ function(send, wait, done, ch) {
382
+ wait(defs.BasicPublish)()
383
+ .then(wait(defs.BasicProperties))
377
384
  // no content frame for a zero-length message
378
- .then(await(defs.BasicPublish))
385
+ .then(wait(defs.BasicPublish))
379
386
  .then(succeed(done), fail(done));
380
387
  }));
381
388
 
@@ -388,9 +395,9 @@ test("delivery", channelTest(
388
395
  }, done);
389
396
  });
390
397
  },
391
- function(send, await, done, ch) {
398
+ function(send, wait, done, ch) {
392
399
  completes(function() {
393
- send(defs.BasicDeliver, DELIVER_FIELDS, ch, new Buffer('barfoo'));
400
+ send(defs.BasicDeliver, DELIVER_FIELDS, ch, Buffer.from('barfoo'));
394
401
  }, done);
395
402
  }));
396
403
 
@@ -399,13 +406,13 @@ test("zero byte msg", channelTest(
399
406
  open(ch);
400
407
  ch.on('delivery', function(m) {
401
408
  completes(function() {
402
- assert.deepEqual(new Buffer(0), m.content);
409
+ assert.deepEqual(Buffer.alloc(0), m.content);
403
410
  }, done);
404
411
  });
405
412
  },
406
- function(send, await, done, ch) {
413
+ function(send, wait, done, ch) {
407
414
  completes(function() {
408
- send(defs.BasicDeliver, DELIVER_FIELDS, ch, new Buffer(''));
415
+ send(defs.BasicDeliver, DELIVER_FIELDS, ch, Buffer.from(''));
409
416
  }, done);
410
417
  }));
411
418
 
@@ -414,16 +421,18 @@ test("bad delivery", channelTest(
414
421
  var errorAndClose = latch(2, done);
415
422
  ch.on('error', function(error) {
416
423
  assert.strictEqual(505, error.code);
424
+ assert.strictEqual(60, error.classId);
425
+ assert.strictEqual(60, error.methodId);
417
426
  succeed(errorAndClose)();
418
427
  });
419
428
  ch.on('close', succeed(errorAndClose));
420
429
  open(ch);
421
430
  },
422
- function(send, await, done, ch) {
431
+ function(send, wait, done, ch) {
423
432
  send(defs.BasicDeliver, DELIVER_FIELDS, ch);
424
433
  // now send another deliver without having sent the content
425
434
  send(defs.BasicDeliver, DELIVER_FIELDS, ch);
426
- return await(defs.ChannelClose)()
435
+ return wait(defs.ChannelClose)()
427
436
  .then(function() {
428
437
  send(defs.ChannelCloseOk, {}, ch);
429
438
  }).then(succeed(done), fail(done));
@@ -440,7 +449,7 @@ test("bad content send", channelTest(
440
449
  });
441
450
  }, done);
442
451
  },
443
- function(send, await, done, ch) {
452
+ function(send, wait, done, ch) {
444
453
  done();
445
454
  }));
446
455
 
@@ -452,11 +461,11 @@ test("bad properties send", channelTest(
452
461
  ch.sendMessage({routingKey: 'foo',
453
462
  exchange: 'amq.direct'},
454
463
  {contentEncoding: 7},
455
- new Buffer('foobar'));
464
+ Buffer.from('foobar'));
456
465
  });
457
466
  }, done);
458
467
  },
459
- function(send, await, done, ch) {
468
+ function(send, wait, done, ch) {
460
469
  done();
461
470
  }));
462
471
 
@@ -468,14 +477,16 @@ test("bad consumer", channelTest(
468
477
  });
469
478
  ch.on('error', function(error) {
470
479
  assert.strictEqual(541, error.code);
480
+ assert.strictEqual(undefined, error.classId);
481
+ assert.strictEqual(undefined, error.methodId);
471
482
  succeed(errorAndClose)();
472
483
  });
473
484
  ch.on('close', succeed(errorAndClose));
474
485
  open(ch);
475
486
  },
476
- function(send, await, done, ch) {
477
- send(defs.BasicDeliver, DELIVER_FIELDS, ch, new Buffer('barfoo'));
478
- return await(defs.ChannelClose)()
487
+ function(send, wait, done, ch) {
488
+ send(defs.BasicDeliver, DELIVER_FIELDS, ch, Buffer.from('barfoo'));
489
+ return wait(defs.ChannelClose)()
479
490
  .then(function() {
480
491
  send(defs.ChannelCloseOk, {}, ch);
481
492
  }).then(succeed(done), fail(done));
@@ -487,6 +498,8 @@ test("bad send in consumer", channelTest(
487
498
  ch.on('close', succeed(errorAndClose));
488
499
  ch.on('error', function(error) {
489
500
  assert.strictEqual(541, error.code);
501
+ assert.strictEqual(undefined, error.classId);
502
+ assert.strictEqual(undefined, error.methodId);
490
503
  succeed(errorAndClose)();
491
504
  });
492
505
 
@@ -498,12 +511,12 @@ test("bad send in consumer", channelTest(
498
511
 
499
512
  open(ch);
500
513
  },
501
- function(send, await, done, ch) {
514
+ function(send, wait, done, ch) {
502
515
  completes(function() {
503
516
  send(defs.BasicDeliver, DELIVER_FIELDS, ch,
504
- new Buffer('barfoo'));
517
+ Buffer.from('barfoo'));
505
518
  }, done);
506
- return await(defs.ChannelClose)()
519
+ return wait(defs.ChannelClose)()
507
520
  .then(function() {
508
521
  send(defs.ChannelCloseOk, {}, ch);
509
522
  }).then(succeed(done), fail(done));
@@ -518,9 +531,9 @@ test("return", channelTest(
518
531
  });
519
532
  open(ch);
520
533
  },
521
- function(send, await, done, ch) {
534
+ function(send, wait, done, ch) {
522
535
  completes(function() {
523
- send(defs.BasicReturn, DELIVER_FIELDS, ch, new Buffer('barfoo'));
536
+ send(defs.BasicReturn, DELIVER_FIELDS, ch, Buffer.from('barfoo'));
524
537
  }, done);
525
538
  }));
526
539
 
@@ -533,7 +546,7 @@ test("cancel", channelTest(
533
546
  });
534
547
  open(ch);
535
548
  },
536
- function(send, await, done, ch) {
549
+ function(send, wait, done, ch) {
537
550
  completes(function() {
538
551
  send(defs.BasicCancel, {
539
552
  consumerTag: 'product of society',
@@ -552,7 +565,7 @@ function confirmTest(variety, Method) {
552
565
  });
553
566
  open(ch);
554
567
  },
555
- function(send, await, done, ch) {
568
+ function(send, wait, done, ch) {
556
569
  completes(function() {
557
570
  send(Method, {
558
571
  deliveryTag: 1,
@@ -578,7 +591,7 @@ test("out-of-order acks", channelTest(
578
591
  ch.pushConfirmCallback(allConfirms);
579
592
  open(ch);
580
593
  },
581
- function(send, await, done, ch) {
594
+ function(send, wait, done, ch) {
582
595
  completes(function() {
583
596
  send(defs.BasicAck, {deliveryTag: 2, multiple: false}, ch);
584
597
  send(defs.BasicAck, {deliveryTag: 3, multiple: false}, ch);
@@ -601,7 +614,7 @@ test("not all out-of-order acks", channelTest(
601
614
  });
602
615
  open(ch);
603
616
  },
604
- function(send, await, done, ch) {
617
+ function(send, wait, done, ch) {
605
618
  completes(function() {
606
619
  send(defs.BasicAck, {deliveryTag: 2, multiple: false}, ch);
607
620
  send(defs.BasicAck, {deliveryTag: 1, multiple: false}, ch);