test/msgr/test_msgr: Fix potential unsafe cond wakeup and wrap check

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
PipeConnection: Avoid deadlock when calling is_connected

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>