Remove test atom for socket
Refactor code for ring middleware usage