update test code with threads

not formatted fully for current implementation of socket library.