IProxyService.setProxyData 影响系统属性

IProxyService.setProxyData affects system properties

在测试中,我试图以编程方式更改 Eclipse 代理设置,而不直接影响 System 属性。

我目前的尝试是这样的:

    httpProxyData.setHost(host)
    httpProxyData.setPort(port)
    httpProxyData.setUserid(userId)
    httpProxyData.setPassword(password)

    proxyService.setProxyData((IProxyData[]) [
        httpProxyData
    ])

我的代理服务设置如下:

    proxyService.setProxiesEnabled(true)
    proxyService.setSystemProxiesEnabled(false)

proxyService.setProxyData执行时,System.getproperty("http.proxyHost")立即变为hostIProxyService API 声明 System 属性不会受到影响。我希望 System 属性仅受我稍后或更早时间设置 System.setProperty(..., ...) 的影响。

我做错了什么吗?

文档说“不影响系统代理的设置”- 我认为他们的意思是它不会更改操作系统中的设置。

查看它总是调用 System.setProperty 的代码(它只为当前 JVM 设置 属性)。