I'm just doing what the example ssl client does from PolarSSL website.