Stop sharing write headers across all instances of transports
diff --git a/lib/nodejs/lib/thrift/buffered_transport.js b/lib/nodejs/lib/thrift/buffered_transport.js
index 113e216..f0d5d4a 100644
--- a/lib/nodejs/lib/thrift/buffered_transport.js
+++ b/lib/nodejs/lib/thrift/buffered_transport.js
@@ -24,6 +24,7 @@
 module.exports = TBufferedTransport;
 
 function TBufferedTransport(buffer, callback) {
+  THeaderTransport.call(this);
   this.defaultReadBufferSize = 1024;
   this.writeBufferSize = 512; // Soft Limit
   this.inBuf = new Buffer(this.defaultReadBufferSize);
@@ -34,7 +35,7 @@
   this.onFlush = callback;
 };
 
-TBufferedTransport.prototype = new THeaderTransport();
+Object.setPrototypeOf(TBufferedTransport.prototype, THeaderTransport.prototype);
 
 TBufferedTransport.prototype.reset = function() {
   this.inBuf = new Buffer(this.defaultReadBufferSize);
diff --git a/lib/nodejs/lib/thrift/framed_transport.js b/lib/nodejs/lib/thrift/framed_transport.js
index 0d424d2..9a50a73 100644
--- a/lib/nodejs/lib/thrift/framed_transport.js
+++ b/lib/nodejs/lib/thrift/framed_transport.js
@@ -24,6 +24,7 @@
 module.exports = TFramedTransport;
 
 function TFramedTransport(buffer, callback) {
+  THeaderTransport.call(this);
   this.inBuf = buffer || new Buffer(0);
   this.outBuffers = [];
   this.outCount = 0;
@@ -31,20 +32,20 @@
   this.onFlush = callback;
 };
 
-TFramedTransport.prototype = new THeaderTransport();
+Object.setPrototypeOf(TFramedTransport.prototype, THeaderTransport.prototype);
 
 TFramedTransport.receiver = function(callback, seqid) {
   var residual = [];
-  
+
   return function(data) {
     // push received data to residual
     for(var i = 0; i < data.length; ++i) {
       residual.push(data[i])
     }
 
-    while (residual.length > 0) {      
+    while (residual.length > 0) {
       if (residual.length < 4) {
-		// Not enough bytes to continue, save and resume on next packet
+        // Not enough bytes to continue, save and resume on next packet
         return;
       }
       // get single package sieze
@@ -57,7 +58,7 @@
       // splice first 4 bytes
       residual.splice(0, 4)
       // get package data
-      var frame = Buffer.from(residual.splice(0, frameSize));      
+      var frame = Buffer.from(residual.splice(0, frameSize));
       callback(new TFramedTransport(frame), seqid);
     }
   };
diff --git a/lib/nodejs/test/header.test.js b/lib/nodejs/test/header.test.js
index efd7f81..99bb832 100644
--- a/lib/nodejs/test/header.test.js
+++ b/lib/nodejs/test/header.test.js
@@ -39,6 +39,19 @@
     assert.equals(headers.Trace, "abcde");
     assert.end();
   },
+  "Should read different headers from different payload": function(assert) {
+    const transport = new TFramedTransport();
+    const buf = Buffer.from(headerPayload);
+    buf[24] = 115; // Change Parent to Parens
+    buf[32] = 122; // Change shoobar to shoobaz
+    transport.inBuf = buf;
+
+    const headers = transport.readHeaders();
+    assert.equals(headers.Parent, undefined);
+    assert.equals(headers.Parens, "shoobaz");
+    assert.equals(headers.Trace, "abcde");
+    assert.end();
+  },
   "Should read headers when reading message begin": function(assert) {
     const transport = new TFramedTransport();
     transport.inBuf = Buffer.from(headerPayload);
@@ -70,6 +83,23 @@
     assert.equals(headers.boobooboo, "fooshoopoo");
     assert.equals(headers.a, "z");
     assert.end();
+  },
+  "Separate transports should have separate headers": function(assert) {
+    const writeTransport = new TFramedTransport();
+    writeTransport.setProtocolId(THeaderTransport.SubprotocolId.BINARY);
+    writeTransport.setWriteHeader("foo", "bar");
+    const headers = writeTransport.getWriteHeaders();
+
+    const otherWriteTransport = new TFramedTransport();
+    otherWriteTransport.setProtocolId(THeaderTransport.SubprotocolId.BINARY);
+    otherWriteTransport.setWriteHeader("otherfoo", "baz");
+    const otherHeaders = otherWriteTransport.getWriteHeaders();
+
+    assert.equals(headers.foo, "bar");
+    assert.equals(headers.otherfoo, undefined);
+    assert.equals(otherHeaders.foo, undefined);
+    assert.equals(otherHeaders.otherfoo, "baz");
+    assert.end();
   }
 };