extracted the connect routine in client code
fixed wrong function def in client
adding stateless features that can be turned on with EXTENSION_STATELESS
if doing so a simplest client "statelessClient" will be compiled to test