What happens during a TCP/IP three-way handshake, and how does it relate to establishing secure connections?