maxogden/multiplex — pull request #15 by mafintosh (2014-11-08 00:32:12+00:00)
Title: Protobuf rewrite

This rewrites multiplex to use protocol buffers and fixes name clashing

Currently if both end call `createStream(name)` with the same `name` will result in messages being shared between the two streams.

This PR changes this by always using an internal channel number for each stream that is opened.
All outgoing messages are sent with equal channel numbers and incoming are sent with odd numbers

```
odd : stream_id = (channel - 1) / 2 # remote -> local
even : stream_id = channel / 2 # local -> remote
```

The `name` of stream is only sent with the first message. This also saves a bit of bandwidth

All tests are passing except the overflow one (I've commented it out as it seemed coupled to the old impl)

In addition to the name fix streams are automatically garbage collected as well now