如何在 Html 单元的 HTTP 连接中覆盖 DNS
How to override DNS in HTTP connections in Html Unit
我想在使用 Html 单元时覆盖 DNS 解析,以便我可以测试负载平衡器后面的显式服务器。这应该在不更改 etc/hosts 文件的情况下完成。
这个问题得到了如何用普通 java 解决该任务的答案:
但我需要一个 Html 单位的解决方案。
Html 单位使用apache httpclient。
是否可以更改 httpclient 的连接管理器?
(见上面的其他问题)
final WebClient webClient = new WebClient();
webClient.getOptions().set???
替换默认的HttpClient
used by WebClient
, call setWebConnection()
with a custom subclass of HttpWebConnection
where you override createHttpClient()
。
我想在使用 Html 单元时覆盖 DNS 解析,以便我可以测试负载平衡器后面的显式服务器。这应该在不更改 etc/hosts 文件的情况下完成。
这个问题得到了如何用普通 java 解决该任务的答案:
但我需要一个 Html 单位的解决方案。
Html 单位使用apache httpclient。 是否可以更改 httpclient 的连接管理器? (见上面的其他问题)
final WebClient webClient = new WebClient();
webClient.getOptions().set???
替换默认的HttpClient
used by WebClient
, call setWebConnection()
with a custom subclass of HttpWebConnection
where you override createHttpClient()
。