Fixed some timing issues in Socket
Created by: agraubert
Sometimes rapid sending and receiving can cause issues on the Socket, so I added locks to enforce serial access to send and receive
I also added some assertions to the security tests to ensure that all tasks have been killed