Apache Camel配置无效代理仍可请求成功问题排查
Apache Camel代理配置无效问题
我是Apache Camel新手,通过编码学习。编写了如下简单路由:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd "> <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="timer:timer?repeatCount=1"/> <to uri="https://v2.jokeapi.dev/joke/Any"/> <log message="${body}"/> </route> </camelContext> </beans>
对应的集成测试代码为:
@CamelSpringBootTest public class JokeIT { @Autowired CamelContext camelContext; @Test void test_positive() throws InterruptedException { NotifyBuilder notification = new NotifyBuilder(camelContext) .from("timer:timer?repeatCount=1").whenDone(1) .create(); camelContext.start(); notification.matches(10, TimeUnit.SECONDS) ; camelContext.stop(); } }
执行命令mvn clean compile test-compile failsafe:integration-test后,测试通过并正常打印响应结果。但奇怪的是,即使将to节点的URI修改为<to uri="https://v2.jokeapi.dev/joke/Any?proxyAuthHost=abcd"/>,或是设置不存在的proxyHost参数,测试仍能通过并打印响应内容。我预期配置不可用代理时测试应该失败,请问这是什么原因?是否我遗漏了某些配置?
内容的提问来源于stack exchange,提问作者Alex
相关产品推荐
相关产品推荐

