refine ssl connection