Implement `make_future_failure`

Which creates an already failed `future` object from a exception object.
Add `encode()` function in `codecs.hpp`

Which encodes a `message` object regardless its concrete message type.
Fix missing const qualifier in `message::connect()`
Some refactors in `mock_connection`

Promoted from struct to class, now it considers the connection close
when there are no more bytes available for reading. That is used by
`session` class to determine the session is over.