Search code examples
javaproxyapache-camelsocksboxapiv2

Socks proxy failure with camel-box component


I've got the camel-box component working well via the corporate web proxy but it is very slow. I tried using the socks proxy instead, which works well for me for sftp transfers but it fails with almost no useful error message. Just an exception which I'll dig out and add to the question but didn't tell me anything. Can anyone spot anything wrong with my proxy configuration? This is equivalent to my 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="[email protected]"/>
    <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>

here is the exception: http://pastebin.com/GpBeHJiD


Solution

  • So to formally answer my question, the error in the config is that the socks parameter needs to be boolean as follows:

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

    But the real problem is that camel-box in Camel 2.14.1 only has socks support for the login process not for the restful client.

    I've submitted a patch for this.

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