added function gen_client_context

Signed-off-by: abbr <wenfred@gmail.com>