bridge: Simpler handling of closing channels during open

When opening a new channel, we need to wait until after the
mainloop has run before emitting signals, so that signal handlers
can be connected.

Previously each channel would do this in its own way. This puts
that in the base class so it's consistent.

Closes #1421
bridge: Implement an echo channel payload

And a test that uses it. This will become useful for checking of
behavior of binary channels independent of the channel implementation.
bridge: Support for binary and base64 encoding in channels

This is mostly underlying work, and not yet exposed in cockpit.js
By passing "binary": "raw" in a channel raw data will be sent, this
is used by the resource1 channel for now.

By passing "binary": "base64" in a channel, all received data will
be assumed to be base64 encoded, and sent data will be encoded on
the way out.
bridge: Rename 'text-stream' payload to 'stream'

Depending on whether the channel is binary or not, it can handle
binary data.

Closes #1427