Make queue use semaphore to be sure connect and disconnect are synched with it

Signed-off-by: Juan Martin Runge <jmrunge@gmail.com>
Added disconnection functionality

Signed-off-by: Juan Martin Runge <jmrunge@gmail.com>
Added disconnection to tests

Signed-off-by: Juan Martin Runge <jmrunge@gmail.com>