add TLS Socket Name Indication (SNI) support, and clean up socket address utility routines in low-level socket library