The test will fail occasionally, especially on OSX. This is due to a peer disconnection happening before the connection check completed.
This diff delays sending the invalid message and prevents this wrong operation ordering.
Note that I couldn't reproduce the issue locally, but at least this doesn't make things worst.