Fixed code so works with signed certificate on test server