fix writer error broadcasting pre-connection
add initial tests. Closes #1