Refactor the stub socket
Refacotr stub socket