Fixes for SocketFactory and delete socket

Also removed all_lib_tests. I didn't commit all the files before.
PEBKAC.