TCP sockets are a simple and common way of communicating over a network. Adding the TLS layer on top of a standard TCP socket is simple with Go's standard library.
A client dials a TLS server just like a standard socket. Clients typically aren't required to have any sort of key or certificate, but a server could implement client-side authentication and only allow certain users to connect.
This program will connect to a TLS server and send the contents of STDIN to the remote server and read the response. We can use this program to test our basic TLS echo server created in the previous section.
Before running this program, make sure that the TLS server from the previous section is running so that you can connect.