added sample code for self-signed certificates