Whenever you need to test an application that sends and receives data through tcp sockets and don't have enough time to build a server or don't feel the need for a server because anything that would bounce socket data back is sufficient, try using netcat with a pipe. This is the solution I still use today when I need a simple and fast way to test if the data sent from the application is correct:
On the server side:
Create a pipe in the filesystem with 'mknod' and send its contents to netcat.
netcat is listening at port 12345 and writing whatever it receives to the pipe.
$ mknod pipe p
$ cat pipe | nc -l -p 12345 > pipe
For the client side launch your application. I'll demonstrate it using telnet:
$ telnet localhost 12345
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
That's all. I hope this information is helpful!