THRIFT-2376 nodejs: allow Promise style calls for client and server
patch:  Pierre Lamot
diff --git a/lib/nodejs/test/client.js b/lib/nodejs/test/client.js
index 43d88f0..2aa2295 100644
--- a/lib/nodejs/test/client.js
+++ b/lib/nodejs/test/client.js
@@ -28,6 +28,7 @@
 var ThriftProtocols = require('thrift/protocol');
 var ThriftTest = require('./gen-nodejs/ThriftTest');
 var ThriftTestDriver = require('./thrift_test_driver').ThriftTestDriver;
+var ThriftTestDriverPromise = require('./thrift_test_driver_promise').ThriftTestDriver;
 
 var program = require('commander');
 
@@ -35,10 +36,12 @@
   .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|json) [protocol]')
   .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed) [transport]')
   .option('--ssl', 'use SSL transport')
+  .option('--promise', 'test with promise style functions')
   .parse(process.argv);
 
 var protocol = undefined;
 var transport =  undefined;
+var testDriver = undefined;
 
 if (program.protocol === "binary") {
   protocol = ThriftProtocols.TBinaryProtocol;
@@ -58,6 +61,12 @@
   transport = ThriftTransports.TBufferedTransport;
 }
 
+if (program.promise) {
+  testDriver = ThriftTestDriverPromise;
+} else {
+  testDriver = ThriftTestDriver;
+}
+
 var options = {
   transport: transport,
   protocol: protocol
@@ -78,7 +87,7 @@
   assert(false, err);
 });
 
-ThriftTestDriver(client, function (status) {
+testDriver(client, function (status) {
   console.log(status);
   connection.end();
 });