channel: fix `REQ` definition for msgpack-rpc logging
msgpack-rpc: Terminate server->client calls when the channel closes
test: Small fixes and improvements to functional helpers.lua

- Move the cleanup function definition into `restart()` so restart can be
  selectively used as a hook
- Improve error handling: Before this, errors while running the event loop would
  cause busted to get stuck. Now the error is properly raised by stopping the
  event loop first.
input: Fix conversion error in `convert_input()`

The `rbuffer_consumed` was being passed a consumed count from another buffer,
causing integer overflow in `rbuffer_relocate`.

Fixes #1343
Merge PR #1354 'Fixes to channel.c, input.c and helpers.lua'
legacy tests: migrate test4
legacy tests: migrate test102
legacy tests: migrate test9
legacy tests: migrate test22
legacy tests: migrate test106
legacy tests: migrate test18
legacy tests: migrate test_options
legacy tests: migrate test_insertcount
legacy tests: migrate test_utf8
legacy tests: migrate test81
legacy tests: migrate test_changelist
legacy tests: migrate test_autoformat_join
legacy tests: migrate test21
legacy tests: migrate test56
Clean vim registers before each test.