change context creation params to struct

*** This patch changes an API all apps use ***

Context creation parameters are getting a bit out of control, this
patch creates a struct to contain them.

All the test apps are updated accordingly.

Signed-off-by: Andy Green <andy.green@linaro.org>
align max frame for mirror protocol to what the code does

Signed-off-by: Andy Green <andy.green@linaro.org>
correct test client to close synchronously with last send

Noticed previously the test client lifetime is decoupled from
the actual send activity.  With SSL if the connection starts but
there is a period of SSL-layer "blocking" (actually fail-and-retry)
the mirror lifetime could be exhausted before the connection really
completed, making it stall after it was then closed.

This corrects that so connection lifetime management is done in the
send callback.

Signed-off-by: Andy Green <andy.green@linaro.org>
remove receiving timeout for client

Now we enforce nonblocking everywhere, hopefully properly,
this rx timeout stuff shouldn't be needed.

Signed-off-by: Andy Green <andy.green@linaro.org>
introduce keepalive option and make common socket options function

Signed-off-by: Andy Green <andy.green@linaro.org>