You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2015/04/28 16:04:07 UTC

[1/2] camel git commit: CAMEL-8707 Fixed the issue of camel-smpps doesn't work over proxy with thanks to Gururaja

Repository: camel
Updated Branches:
  refs/heads/camel-2.14.x 77e7aa258 -> 6bfcd9bf2


CAMEL-8707 Fixed the issue of camel-smpps doesn't work over proxy with thanks to Gururaja


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4ce91e08
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4ce91e08
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4ce91e08

Branch: refs/heads/camel-2.14.x
Commit: 4ce91e08c4dce8d5a29cfbdb0d0d7f0b5be7e88c
Parents: 77e7aa2
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Apr 28 14:23:24 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Apr 28 22:01:45 2015 +0800

----------------------------------------------------------------------
 .../component/smpp/SmppConnectionFactory.java      | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4ce91e08/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java
index 1f9d932..ff8a57b 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java
@@ -55,6 +55,7 @@ import java.io.OutputStream;
 import java.net.Socket;
 
 import javax.net.SocketFactory;
+import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 
 import org.apache.camel.RuntimeCamelException;
@@ -84,15 +85,25 @@ public final class SmppConnectionFactory implements ConnectionFactory {
         try {
             Socket socket;
             SocketFactory socketFactory;
-            socketFactory = config.getUsingSSL() ? SSLSocketFactory.getDefault() : SocketFactory.getDefault();
+            socketFactory = config.getUsingSSL() && config.getHttpProxyHost() == null ? SSLSocketFactory
+                .getDefault() : SocketFactory.getDefault();
             if (config.getHttpProxyHost() != null) {
+                // setup the proxy tunnel
                 socket = socketFactory.createSocket(config.getHttpProxyHost(), config.getHttpProxyPort());
                 connectProxy(host, port, socket);
             } else {
                 socket = socketFactory.createSocket(host, port);
             }
-            return new SocketConnection(socket);
 
+            if (config.getUsingSSL() && config.getHttpProxyHost() != null) {
+                // Init the SSL socket which is based on the proxy socket
+                SSLSocketFactory sslSocketFactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
+                SSLSocket sslSocket = (SSLSocket)sslSocketFactory.createSocket(socket, host, port, true);
+                sslSocket.startHandshake();
+                socket = sslSocket;
+            }
+
+            return new SocketConnection(socket);
         } catch (Exception e) {
             throw new IOException(e.getMessage());
         }
@@ -167,4 +178,4 @@ public final class SmppConnectionFactory implements ConnectionFactory {
             }
         }
     }
-}
\ No newline at end of file
+}


[2/2] camel git commit: CAMEL-8712 - User the Netty Timer per Component

Posted by ni...@apache.org.
CAMEL-8712 - User the Netty Timer per Component

Conflicts:
	components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6bfcd9bf
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6bfcd9bf
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6bfcd9bf

Branch: refs/heads/camel-2.14.x
Commit: 6bfcd9bf257a66e98a9f7935d2c0d94a4454d839
Parents: 4ce91e0
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Apr 28 21:53:31 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Apr 28 22:04:01 2015 +0800

----------------------------------------------------------------------
 .../netty/http/HttpClientPipelineFactory.java          |  2 +-
 .../component/netty/DefaultClientPipelineFactory.java  |  2 +-
 .../apache/camel/component/netty/NettyComponent.java   | 13 +++++++------
 .../camel/component/netty/NettyManualEndpointTest.java |  2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6bfcd9bf/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
index ee77dce..6fde363 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
@@ -108,7 +108,7 @@ public class HttpClientPipelineFactory extends ClientPipelineFactory {
             if (LOG.isTraceEnabled()) {
                 LOG.trace("Using request timeout {} millis", producer.getConfiguration().getRequestTimeout());
             }
-            ChannelHandler timeout = new ReadTimeoutHandler(NettyComponent.getTimer(), producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS);
+            ChannelHandler timeout = new ReadTimeoutHandler(producer.getEndpoint().getTimer(), producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS);
             pipeline.addLast("timeout", timeout);
         }
         

http://git-wip-us.apache.org/repos/asf/camel/blob/6bfcd9bf/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
index 556ee98..1e40f4c 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
@@ -85,7 +85,7 @@ public class DefaultClientPipelineFactory extends ClientPipelineFactory  {
             if (LOG.isTraceEnabled()) {
                 LOG.trace("Using request timeout {} millis", producer.getConfiguration().getRequestTimeout());
             }
-            ChannelHandler timeout = new ReadTimeoutHandler(NettyComponent.getTimer(), producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS);
+            ChannelHandler timeout = new ReadTimeoutHandler(producer.getEndpoint().getTimer(), producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS);
             addToPipeline("timeout", channelPipeline, timeout);
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/6bfcd9bf/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java
index 3954e2e..210ed66 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java
@@ -33,7 +33,7 @@ import org.jboss.netty.util.Timer;
 
 public class NettyComponent extends UriEndpointComponent {
     // use a shared timer for Netty (see javadoc for HashedWheelTimer)
-    private static volatile Timer timer;
+    private Timer timer;
     private NettyConfiguration configuration;
     private int maximumPoolSize = 16;
     private OrderedMemoryAwareThreadPoolExecutor executorService;
@@ -104,7 +104,7 @@ public class NettyComponent extends UriEndpointComponent {
         this.maximumPoolSize = maximumPoolSize;
     }
 
-    public static Timer getTimer() {
+    public Timer getTimer() {
         return timer;
     }
 
@@ -146,9 +146,10 @@ public class NettyComponent extends UriEndpointComponent {
 
     @Override
     protected void doStop() throws Exception {
-        timer.stop();
-        timer = null;
-
+        if (timer != null) {
+            timer.stop();
+            timer = null;
+        }
         if (executorService != null) {
             getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
             executorService = null;
@@ -157,4 +158,4 @@ public class NettyComponent extends UriEndpointComponent {
         super.doStop();
     }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/6bfcd9bf/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyManualEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyManualEndpointTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyManualEndpointTest.java
index c95147d..770bf8f 100644
--- a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyManualEndpointTest.java
+++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyManualEndpointTest.java
@@ -69,7 +69,7 @@ public class NettyManualEndpointTest extends BaseNettyTest {
                 // create and start endpoint, pass in null as endpoint uri
                 // as we create this endpoint manually
                 endpoint = new NettyEndpoint(null, component, nettyConfig);
-                endpoint.setTimer(NettyComponent.getTimer());
+                endpoint.setTimer(component.getTimer());
                 endpoint.start();
 
                 from(endpoint).to("mock:result");