Apm-agent by default only enables ssl, without ssl you get this error. try with https://127.0.0.1:8200