Use SocketQueryGroup to track query listeners; add socket tests.