使用camel-box组件进行Socks代理失败

时间:2015-01-21 19:08:30

标签: java proxy apache-camel socks boxapiv2

我已经通过企业网络代理使得camel-box组件运行良好,但速度非常慢。我尝试使用socks代理,这适用于我的sftp传输,但它失败,几乎没有有用的错误消息。只是一个例外,我会挖掘并添加问题,但没有告诉我任何事情。有人能发现我的代理配置有什么问题吗?这相当于我的applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd        http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd     ">
  <camelContext xmlns="http://camel.apache.org/schema/spring" id="boxtest">
    <route id="getids">
      <description>Fetch the names and Box unique ids for the root folder</description>
      <from uri="jetty:http://0.0.0.0:/info"/>
        <to uri="box://folders/getFolderItems?folderId=0&amp;pagingRequest=#pr"/>
        <to uri="bean:dump"/>
    </route>
  </camelContext>
  <bean class="org.apache.camel.component.box.BoxComponent" id="box">
    <property name="configuration" ref="cfg"/>
  </bean>
  <bean class="org.apache.camel.component.box.BoxConfiguration" id="cfg">
    <property name="httpParams">
      <map>
        <entry key="http.route.socks-proxy" value="true"/>
        <entry key="http.route.default-proxy">
          <bean class="org.apache.http.HttpHost" id="proxy">
            <constructor-arg index="0" value="my-socks-proxy"/>
            <constructor-arg index="1" value="1085"/>
          </bean>
        </entry>
      </map>
    </property>
    <property name="userName" value="j@b.com"/>
    <property name="clientId" value="a83445cd422dbfc62ba9"/>
    <property name="clientSecret" value="1701df702c00126783fc1701df702c00126783fc"/>
    <property name="authSecureStorage" ref="auth"/>
  </bean>
  <bean id="auth" class="mypackage.Auth">
    <property name="filename" value="box_credentials.properties"/>
  </bean>
  <bean id="pr" class="com.box.boxjavalibv2.requests.requestobjects.BoxPagingRequestObject"/>
</beans>

这是例外:http://pastebin.com/GpBeHJiD

1 个答案:

答案 0 :(得分:0)

因此,为了正式回答我的问题,配置中的错误是socks参数需要布尔值如下:

    <entry key="http.route.socks-proxy">
      <value type="java.lang.Boolean">true</value>
    </entry>

但真正的问题是Camel 2.14.1中的camel-box只对登录过程提供了袜子支持,而不是对于宁静的客户端。

我已为此提交了补丁。

https://issues.apache.org/jira/browse/CAMEL-8272