Updated protocol-facing code for new binary protocol

This is a squash of four boring commits. The gist is that client.js
encoding and decoding stuff was updated to take an array of encoded packets
to write, and to handle sequences of binary packets to decode. There was
also merging done with upstream. All tests are passing.