Add tests to socket_request and xml_request. Add improvement to several session handling into xml_request.