[connection] move client code into new function
[connection] move client code into new function

mchalain/libhttpserver,ouistiti-project/libhttpserver,mchalain/libhttpserver,ouistiti-project/libhttpserver