A demultiplexer combines the output of multiple channels into a single (virtual) channel. Channels can be added and removed from the demultiplexer. For each new channel, a separate thread is started which retrieves messages from the channel and adds them to a message queue maintained by the multiplexer. Clients calling method Receive will receive the message retrieved from that queue. Note that this pattern is similar to the Unix SELECT system call.
Although the Demux class implements interface Transportable, it is only envisaged that Receive should be used. Method Send is not implemented; for sending messages, the underlying transport should be used (e.g. a channel).