client.c: Fix ordering of encryption selection to fix PSK
client.c: Fix ordering of encryption selection to fix PSK

PR #338 broke the PKI/PSK selection order for the encryption type
to use when trying to include the SNI even if PSK or PKI had not
been configured - even though coaps or coaps+tcp was in use. If
PSK had been defined, then it failed.

This fix puts the creation of the correct type of session into a separate function
which is then called from 2 places.

authmillenon/libcoap,authmillenon/libcoap,authmillenon/libcoap