Added improved socket testing.