Fix minor mem leak in server unit tests

The sent message string and sent event ops weren't freed after the last
test was run.
Refactor start_fmt and end_fmt

Reuse code for appending format components and format bounds between the
two functions.
Clean up .clang-format and reformat all code

The .clang-format settings have also been tested to work with the latest
version of clang-format (version 3.6).