cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1381308 - in /cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient: ./ impl/
Date Wed, 05 Sep 2012 19:18:35 GMT
Author: dkulp
Date: Wed Sep  5 19:18:34 2012
New Revision: 1381308

URL: http://svn.apache.org/viewvc?rev=1381308&view=rev
Log:
Rip out the HttpHost based stuff and replace with a CXF specific host that will include the TLS information.

Added:
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpHost.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFConnectionFactory.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFNIOConnectionPool.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFNIOPoolEntry.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/package-info.java
Removed:
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFPlainConnectionFactory.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFSSLConnectionFactory.java
Modified:
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFAsyncRequester.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFConnection.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFConnectionManager.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpRequest.java

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java?rev=1381308&r1=1381307&r2=1381308&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java Wed Sep  5 19:18:34 2012
@@ -63,7 +63,6 @@ import org.apache.cxf.transports.http.co
 import org.apache.cxf.version.Version;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.http.Header;
-import org.apache.http.HttpHost;
 import org.apache.http.HttpResponse;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.entity.BasicHttpEntity;
@@ -161,19 +160,20 @@ public class AsyncHTTPConduit extends UR
                                               int chunkThreshold) throws IOException {
         if (Boolean.TRUE.equals(message.get(USE_ASYNC))) {
             CXFHttpRequest entity = message.get(CXFHttpRequest.class);
-            return new AsyncWrappedOutputStream(message,
+            AsyncWrappedOutputStream out = new AsyncWrappedOutputStream(message,
                                                 needToCacheRequest, 
                                                 isChunking,
                                                 chunkThreshold,
                                                 getConduitName(),
                                                 entity.getURI());
-            
+            entity.setOutputStream(out);
+            return out;
         }
         return super.createOutputStream(message, needToCacheRequest, isChunking, chunkThreshold);
     }
     
     
-    class AsyncWrappedOutputStream extends WrappedOutputStream {
+    public class AsyncWrappedOutputStream extends WrappedOutputStream {
         final HTTPClientPolicy csPolicy;
 
         CXFHttpRequest entity;
@@ -301,18 +301,20 @@ public class AsyncHTTPConduit extends UR
                 
             };
             
-            //FIXME - what to do with a Proxy?
-            //Proxy proxy = proxyFactory.createProxy(csPolicy , entity.getURI());
-            
-            
             if (!output) {
                 entity.removeHeaders("Transfer-Encoding");
                 entity.removeHeaders("Content-Type");
                 entity.setEntity(null);
             }
+            if (url.getScheme().equals("https") && tlsClientParameters == null) {
+                tlsClientParameters = new TLSClientParameters();
+            }
+            CXFHttpHost host = new CXFHttpHost(url.getHost(), url.getPort(), url.getScheme(),
+                                               tlsClientParameters, proxyFactory.createProxy(csPolicy , url));
+            
             connectionFuture = factory.getRequester().execute(
-                        csPolicy,
-                        this,
+                        host,
+                        csPolicy.getConnectionTimeout(),
                         new CXFHttpAsyncRequestProducer(entity, outbuf),
                         new CXFHttpAsyncResponseConsumer(inbuf, responseCallback),
                         new BasicHttpContext(),
@@ -421,11 +423,14 @@ public class AsyncHTTPConduit extends UR
             synchronized (sessionLock) {
                 if (session == null) {
                     try {
-                        sessionLock.wait(csPolicy.getConnectionTimeout());
+                        sessionLock.wait(csPolicy.getConnectionTimeout() * 100);
                     } catch (InterruptedException e) {
                         throw new IOException(e);
                     }
                 }
+                if (session == null) {
+                    throw new IOException("No SSLSession detected");
+                }
             }
             HostnameVerifier verifier;
             if (tlsClientParameters.isUseHttpsURLConnectionDefaultHostnameVerifier()) {
@@ -554,6 +559,7 @@ public class AsyncHTTPConduit extends UR
                 setupConnection(outMessage, this.url, csPolicy);
                 entity = outMessage.get(CXFHttpRequest.class);
                 basicEntity = (BasicHttpEntity)entity.getEntity();
+                entity.setOutputStream(this);
             } catch (URISyntaxException e) {
                 throw new IOException(e);
             }
@@ -602,7 +608,7 @@ public class AsyncHTTPConduit extends UR
             }
         }
     
-        public void verify(HttpHost host, SSLSession sslsession) {            
+        public void verify(SSLSession sslsession) {            
             session = sslsession;
             synchronized (sessionLock) {
                 sessionLock.notifyAll();

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java?rev=1381308&r1=1381307&r2=1381308&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java Wed Sep  5 19:18:34 2012
@@ -32,10 +32,10 @@ import org.apache.cxf.service.model.Endp
 import org.apache.cxf.transport.http.HTTPConduit;
 import org.apache.cxf.transport.http.HTTPTransportFactory;
 import org.apache.cxf.transport.http.HTTPTransportFactory.HTTPConduitFactory;
+import org.apache.cxf.transport.http.asyncclient.impl.CXFConnectionFactory;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
 import org.apache.http.impl.nio.DefaultHttpClientIODispatch;
-import org.apache.http.impl.nio.pool.BasicNIOConnFactory;
 import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
 import org.apache.http.impl.nio.reactor.IOReactorConfig;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
@@ -121,19 +121,16 @@ public class AsyncHTTPConduitFactory imp
         // Create client-side HTTP protocol handler
         CXFAsyncRequestExecutor protocolHandler = new CXFAsyncRequestExecutor();
         // Create client-side I/O event dispatch
-        CXFPlainConnectionFactory plainConnFactory = new CXFPlainConnectionFactory(params);
-        CXFSSLConnectionFactory sslConnFactory = new CXFSSLConnectionFactory(params);
+        CXFConnectionFactory connFactory = new CXFConnectionFactory(params);
         final IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(protocolHandler, 
-                plainConnFactory);
+                connFactory);
         // Create client-side I/O reactor
         IOReactorConfig config = new IOReactorConfig();
         config.setTcpNoDelay(true);
         
         final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(config);
         // Create HTTP connection pool
-        BasicNIOConnFactory poolConnFactory = new BasicNIOConnFactory(
-                plainConnFactory, sslConnFactory);
-        connManager = new CXFConnectionManager(ioReactor, poolConnFactory, params);
+        connManager = new CXFConnectionManager(ioReactor, connFactory, params);
         connManager.setDefaultMaxPerRoute(1000);
         connManager.setMaxTotal(5000);
 
@@ -157,7 +154,7 @@ public class AsyncHTTPConduitFactory imp
         
         requester = new CXFAsyncRequester(connManager, httpproc, 
                 new DefaultConnectionReuseStrategy(), params,
-                sslConnFactory);
+                connFactory);
     }
     
     public CXFAsyncRequester getRequester() throws IOException {

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFAsyncRequester.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFAsyncRequester.java?rev=1381308&r1=1381307&r2=1381308&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFAsyncRequester.java (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFAsyncRequester.java Wed Sep  5 19:18:34 2012
@@ -20,20 +20,18 @@
 package org.apache.cxf.transport.http.asyncclient;
 
 import java.io.IOException;
-import java.util.Collections;
-import java.util.IdentityHashMap;
-import java.util.Map;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
-import org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit.AsyncWrappedOutputStream;
-import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.transport.http.asyncclient.impl.CXFConnectionFactory;
+import org.apache.cxf.transport.http.asyncclient.impl.CXFNIOPoolEntry;
 import org.apache.http.ConnectionClosedException;
 import org.apache.http.ConnectionReuseStrategy;
-import org.apache.http.HttpHost;
 import org.apache.http.concurrent.BasicFuture;
 import org.apache.http.concurrent.FutureCallback;
-import org.apache.http.impl.nio.pool.BasicNIOPoolEntry;
 import org.apache.http.nio.NHttpClientConnection;
 import org.apache.http.nio.protocol.BasicAsyncRequestExecutionHandler;
 import org.apache.http.nio.protocol.HttpAsyncRequestExecutor;
@@ -42,17 +40,11 @@ import org.apache.http.nio.protocol.Http
 import org.apache.http.params.HttpParams;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class CXFAsyncRequester {
 
-    private static final Logger LOG = LoggerFactory.getLogger(CXFAsyncRequester.class);
-
+    private static final Logger LOG = LogUtils.getL7dLogger(CXFAsyncRequester.class);
     
-    private final Map<HttpHost, AsyncWrappedOutputStream> outstandingConnections 
-        = Collections.synchronizedMap(new IdentityHashMap<HttpHost, AsyncWrappedOutputStream>());
-
     private final CXFConnectionManager connManager;
     private final HttpProcessor httppocessor;
     private final ConnectionReuseStrategy reuseStrategy;
@@ -63,18 +55,17 @@ public class CXFAsyncRequester {
             final HttpProcessor httppocessor,
             final ConnectionReuseStrategy reuseStrategy,
             final HttpParams params,
-            CXFSSLConnectionFactory sslConnFactory) {
+            CXFConnectionFactory sslConnFactory) {
         super();
         this.connManager = connManager;
         this.httppocessor = httppocessor;
         this.reuseStrategy = reuseStrategy;
         this.params = params;
-        sslConnFactory.setOutstandingConnectionMap(outstandingConnections);
     }
 
     public <T> Future<T> execute(
-            final HTTPClientPolicy csPolicy,
-            final AsyncWrappedOutputStream asyncWrappedOutputStream,
+            final CXFHttpHost target,
+            final long connectionTimeout,
             final HttpAsyncRequestProducer requestProducer,
             final HttpAsyncResponseConsumer<T> responseConsumer,
             final HttpContext context,
@@ -89,21 +80,15 @@ public class CXFAsyncRequester {
             throw new IllegalArgumentException("HTTP context may not be null");
         }
         BasicFuture<T> future = new BasicFuture<T>(callback);
-        HttpHost target = requestProducer.getTarget();
-        Object tlsCompat = null;
-        if ("https".equals(target.getSchemeName())) {
-            outstandingConnections.put(target, asyncWrappedOutputStream);
-            tlsCompat = new Object();
-        }
         this.connManager.leaseConnection(
-                target, tlsCompat, 
-                csPolicy.getConnectionTimeout(), TimeUnit.MILLISECONDS,
+                target, null, 
+                connectionTimeout, TimeUnit.MILLISECONDS,
                 new ConnRequestCallback<T>(
                 future, requestProducer, responseConsumer, context));
         return future;
     }
 
-    class ConnRequestCallback<T> implements FutureCallback<BasicNIOPoolEntry> {
+    class ConnRequestCallback<T> implements FutureCallback<CXFNIOPoolEntry> {
 
         private final BasicFuture<T> requestFuture;
         private final HttpAsyncRequestProducer requestProducer;
@@ -122,7 +107,7 @@ public class CXFAsyncRequester {
             this.context = context;
         }
 
-        public void completed(final BasicNIOPoolEntry result) {
+        public void completed(final CXFNIOPoolEntry result) {
             if (this.requestFuture.isDone()) {
                 connManager.releaseConnection(result, 0, null);
                 return;
@@ -139,7 +124,7 @@ public class CXFAsyncRequester {
                 try {
                     handler.close();
                 } catch (IOException ex) {
-                    LOG.error(ex.getMessage(), ex);
+                    LOG.log(Level.SEVERE, ex.getMessage(), ex);
                 }
             }
         }
@@ -172,12 +157,12 @@ public class CXFAsyncRequester {
             try {
                 this.requestProducer.close();
             } catch (IOException ioex) {
-                LOG.error(ioex.getMessage(), ioex);
+                LOG.log(Level.SEVERE, ioex.getMessage(), ioex);
             }
             try {
                 this.responseConsumer.close();
             } catch (IOException ioex) {
-                LOG.error(ioex.getMessage(), ioex);
+                LOG.log(Level.SEVERE, ioex.getMessage(), ioex);
             }
         }
 
@@ -186,11 +171,11 @@ public class CXFAsyncRequester {
     class RequestExecutionCallback<T> implements FutureCallback<T> {
 
         private final BasicFuture<T> future;
-        private final BasicNIOPoolEntry poolEntry;
+        private final CXFNIOPoolEntry poolEntry;
 
         RequestExecutionCallback(
                 final BasicFuture<T> future,
-                final BasicNIOPoolEntry poolEntry) {
+                final CXFNIOPoolEntry poolEntry) {
             super();
             this.future = future;
             this.poolEntry = poolEntry;

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFConnection.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFConnection.java?rev=1381308&r1=1381307&r2=1381308&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFConnection.java (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFConnection.java Wed Sep  5 19:18:34 2012
@@ -30,12 +30,13 @@ import org.apache.http.HttpResponseFacto
 import org.apache.http.impl.nio.DefaultNHttpClientConnection;
 import org.apache.http.nio.NHttpClientEventHandler;
 import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.reactor.ssl.SSLIOSession;
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.params.HttpParams;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-class CXFConnection extends DefaultNHttpClientConnection {
+public class CXFConnection extends DefaultNHttpClientConnection {
 
     private static final AtomicLong COUNT = new AtomicLong();
 
@@ -83,6 +84,13 @@ class CXFConnection extends DefaultNHttp
 
     @Override
     public void submitRequest(final HttpRequest request) throws IOException, HttpException {
+        if (iosession instanceof SSLIOSession) {
+            SSLIOSession sslio = (SSLIOSession)iosession;
+            iosession.setAttribute(CXFHttpRequest.class.getName(), request);
+            if (iosession.getAttribute("cxf.handshake.done") != null) {
+                ((CXFHttpRequest)request).getOutputStream().verify(sslio.getSSLSession());
+            }
+        }
         if (LOG.isDebugEnabled()) {
             LOG.debug(this.id + ": "  + request.getRequestLine().toString());
         }
@@ -107,6 +115,7 @@ class CXFConnection extends DefaultNHttp
 
     @Override
     protected void onResponseReceived(final HttpResponse response) {
+        iosession.removeAttribute(CXFHttpRequest.class.getName());
         if (response != null && HEADERLOG.isDebugEnabled()) {
             HEADERLOG.debug(this.id + " << " + response.getStatusLine().toString());
             Header[] headers = response.getAllHeaders();
@@ -114,6 +123,7 @@ class CXFConnection extends DefaultNHttp
                 HEADERLOG.debug(this.id + " << " + headers[i].toString());
             }
         }
+        super.onResponseReceived(response);
     }
 
     @Override
@@ -125,6 +135,7 @@ class CXFConnection extends DefaultNHttp
                 HEADERLOG.debug(this.id + " >> " + headers[i].toString());
             }
         }
+        super.onRequestSubmitted(request);
     }
 
     @Override

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFConnectionManager.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFConnectionManager.java?rev=1381308&r1=1381307&r2=1381308&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFConnectionManager.java (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFConnectionManager.java Wed Sep  5 19:18:34 2012
@@ -23,16 +23,14 @@ import java.io.IOException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.http.HttpHost;
+import org.apache.cxf.transport.http.asyncclient.impl.CXFConnectionFactory;
+import org.apache.cxf.transport.http.asyncclient.impl.CXFNIOConnectionPool;
+import org.apache.cxf.transport.http.asyncclient.impl.CXFNIOPoolEntry;
 import org.apache.http.concurrent.BasicFuture;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.impl.nio.pool.BasicNIOConnPool;
-import org.apache.http.impl.nio.pool.BasicNIOPoolEntry;
-import org.apache.http.nio.NHttpClientConnection;
-import org.apache.http.nio.pool.NIOConnFactory;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
 import org.apache.http.nio.reactor.IOReactorStatus;
-import org.apache.http.nio.reactor.ssl.SSLIOSession;
 import org.apache.http.params.HttpParams;
 import org.apache.http.pool.PoolStats;
 import org.slf4j.Logger;
@@ -43,26 +41,15 @@ class CXFConnectionManager {
     private static final Logger LOG = LoggerFactory.getLogger(BasicNIOConnPool.class);
     
     private final ConnectingIOReactor ioreactor;
-    private final BasicNIOConnPool pool;
+    private final CXFNIOConnectionPool pool;
 
     public CXFConnectionManager(
             final ConnectingIOReactor ioreactor,
-            final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory,
+            final CXFConnectionFactory connFactory,
             final HttpParams params) {
         super();
         this.ioreactor = ioreactor;
-        this.pool = new BasicNIOConnPool(ioreactor, connFactory, params) {
-            protected BasicNIOPoolEntry createEntry(HttpHost host, NHttpClientConnection conn) {
-                BasicNIOPoolEntry e = super.createEntry(host, conn);
-                CXFConnection cc = (CXFConnection)conn;
-                if (cc.getIOSession() instanceof SSLIOSession) {
-                    //Need a way to do comparisons on the TLS stuff
-                    //and also save the SSLEngine and such for use later
-                    e.setState(new Object());
-                }
-                return e;
-            }
-        };
+        this.pool = new CXFNIOConnectionPool(ioreactor, connFactory, params);
     }
 
     @Override
@@ -90,7 +77,7 @@ class CXFConnectionManager {
         LOG.debug("Connection manager shut down");
     }
 
-    private String format(final HttpHost route, final Object state) {
+    private String format(final CXFHttpHost route, final Object state) {
         StringBuilder buf = new StringBuilder();
         buf.append("[route: ").append(route).append("]");
         if (state != null) {
@@ -99,7 +86,7 @@ class CXFConnectionManager {
         return buf.toString();
     }
 
-    private String formatStats(final HttpHost route) {
+    private String formatStats(final CXFHttpHost route) {
         StringBuilder buf = new StringBuilder();
         PoolStats totals = this.pool.getTotalStats();
         PoolStats stats = this.pool.getStats(route);
@@ -111,7 +98,7 @@ class CXFConnectionManager {
         return buf.toString();
     }
 
-    private String format(final BasicNIOPoolEntry entry) {
+    private String format(final CXFNIOPoolEntry entry) {
         StringBuilder buf = new StringBuilder();
         buf.append("[id: ").append(entry.getId()).append("]");
         buf.append("[route: ").append(entry.getRoute()).append("]");
@@ -122,12 +109,12 @@ class CXFConnectionManager {
         return buf.toString();
     }
 
-    public Future<BasicNIOPoolEntry> leaseConnection(
-            final HttpHost route,
+    public Future<CXFNIOPoolEntry> leaseConnection(
+            final CXFHttpHost route,
             final Object state,
             final long connectTimeout,
             final TimeUnit tunit,
-            final FutureCallback<BasicNIOPoolEntry> callback) {
+            final FutureCallback<CXFNIOPoolEntry> callback) {
         if (route == null) {
             throw new IllegalArgumentException("HTTP route may not be null");
         }
@@ -137,13 +124,13 @@ class CXFConnectionManager {
         if (LOG.isDebugEnabled()) {
             LOG.debug("Connection request: " + format(route, state) + formatStats(route));
         }
-        BasicFuture<BasicNIOPoolEntry> future = new BasicFuture<BasicNIOPoolEntry>(callback);
+        BasicFuture<CXFNIOPoolEntry> future = new BasicFuture<CXFNIOPoolEntry>(callback);
         this.pool.lease(route, state, connectTimeout, tunit, new InternalPoolEntryCallback(future));
         return future;
     }
 
     public void releaseConnection(
-            final BasicNIOPoolEntry entry,
+            final CXFNIOPoolEntry entry,
             final long keepalive,
             final TimeUnit tunit) {
         if (entry == null) {
@@ -179,7 +166,7 @@ class CXFConnectionManager {
         return this.pool.getTotalStats();
     }
 
-    public PoolStats getStats(final HttpHost route) {
+    public PoolStats getStats(final CXFHttpHost route) {
         return this.pool.getStats(route);
     }
 
@@ -191,7 +178,7 @@ class CXFConnectionManager {
         this.pool.setDefaultMaxPerRoute(max);
     }
 
-    public void setMaxPerRoute(final HttpHost route, int max) {
+    public void setMaxPerRoute(final CXFHttpHost route, int max) {
         this.pool.setMaxPerRoute(route, max);
     }
 
@@ -203,7 +190,7 @@ class CXFConnectionManager {
         return this.pool.getDefaultMaxPerRoute();
     }
 
-    public int getMaxPerRoute(final HttpHost route) {
+    public int getMaxPerRoute(final CXFHttpHost route) {
         return this.pool.getMaxPerRoute(route);
     }
 
@@ -219,16 +206,16 @@ class CXFConnectionManager {
         this.pool.closeExpired();
     }
 
-    class InternalPoolEntryCallback implements FutureCallback<BasicNIOPoolEntry> {
+    class InternalPoolEntryCallback implements FutureCallback<CXFNIOPoolEntry> {
 
-        private final BasicFuture<BasicNIOPoolEntry> future;
+        private final BasicFuture<CXFNIOPoolEntry> future;
 
-        public InternalPoolEntryCallback(final BasicFuture<BasicNIOPoolEntry> future) {
+        public InternalPoolEntryCallback(final BasicFuture<CXFNIOPoolEntry> future) {
             super();
             this.future = future;
         }
 
-        public void completed(final BasicNIOPoolEntry entry) {
+        public void completed(final CXFNIOPoolEntry entry) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Connection leased: " + format(entry) + formatStats(entry.getRoute()));
             }

Added: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpHost.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpHost.java?rev=1381308&view=auto
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpHost.java (added)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpHost.java Wed Sep  5 19:18:34 2012
@@ -0,0 +1,219 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.transport.http.asyncclient;
+
+import java.io.Serializable;
+import java.net.Proxy;
+import java.util.Locale;
+
+import org.apache.cxf.configuration.jsse.TLSClientParameters;
+import org.apache.http.util.LangUtils;
+
+/**
+ * Holds all of the variables needed to describe an HTTP connection to a host.
+ * This includes remote host name, port and scheme.
+ *
+ * Similar to the HC HttpHost object, but also maintains state about the 
+ * TLS and Proxy settings for the connection
+ */
+public class CXFHttpHost implements Cloneable, Serializable {
+    /** The default scheme is "http". */
+    public static final String DEFAULT_SCHEME_NAME = "http";
+    public static final String SESSION_ATTACHMENT_ID = CXFHttpHost.class.getName();
+
+    private static final long serialVersionUID = -7529410654042457626L;
+
+
+    /** The host to use. */
+    protected final String hostname;
+
+    /** The lower case host, for {@link #equals} and {@link #hashCode}. */
+    protected final String lcHostname;
+
+
+    /** The port to use, defaults to -1 if not set. */
+    protected final int port;
+
+    /** The scheme (lowercased) */
+    protected final String schemeName;
+    
+    protected final Proxy proxy;
+    protected final TLSClientParameters tlsInfo;
+
+    protected final int hashcode;
+
+    /**
+     * Copy constructor for {@link HttpHost HttpHost}.
+     *
+     * @param httphost the HTTP host to copy details from
+     */
+    public CXFHttpHost(final CXFHttpHost httphost) {
+        this(httphost.hostname, httphost.port, httphost.schemeName, httphost.tlsInfo, httphost.proxy);
+    }
+
+    public CXFHttpHost(String hostname, int port, String scheme, TLSClientParameters tlsClientParameters,
+                       Proxy proxy) {
+        if (hostname == null) {
+            throw new IllegalArgumentException("Host name may not be null");
+        }
+        this.hostname   = hostname;
+        this.lcHostname = hostname.toLowerCase(Locale.ENGLISH);
+        if (scheme != null) {
+            this.schemeName = scheme.toLowerCase(Locale.ENGLISH);
+        } else {
+            this.schemeName = DEFAULT_SCHEME_NAME;
+        }
+        this.port = port;
+        this.tlsInfo = tlsClientParameters;
+        this.proxy = proxy;
+        this.hashcode = computeHash();
+    }
+
+    /**
+     * Returns the host name.
+     *
+     * @return the host name (IP or DNS name)
+     */
+    public String getHostName() {
+        return this.hostname;
+    }
+
+    /**
+     * Returns the port.
+     *
+     * @return the host port, or <code>-1</code> if not set
+     */
+    public int getPort() {
+        return this.port;
+    }
+
+    /**
+     * Returns the scheme name.
+     *
+     * @return the scheme name
+     */
+    public String getSchemeName() {
+        return this.schemeName;
+    }
+    
+    public TLSClientParameters getTlsClientParameters() {
+        return tlsInfo;
+    }
+    
+    public Proxy getProxy() {
+        return proxy;
+    }
+
+    /**
+     * Return the host URI, as a string.
+     *
+     * @return the host URI
+     */
+    public String toURI() {
+        StringBuilder buffer = new StringBuilder();
+        buffer.append(this.schemeName);
+        buffer.append("://");
+        buffer.append(this.hostname);
+        if (this.port != -1) {
+            buffer.append(':');
+            buffer.append(Integer.toString(this.port));
+        }
+        return buffer.toString();
+    }
+
+
+    /**
+     * Obtains the host string, without scheme prefix.
+     *
+     * @return  the host string, for example <code>localhost:8080</code>
+     */
+    public String toHostString() {
+        if (this.port != -1) {
+            //the highest port number is 65535, which is length 6 with the addition of the colon
+            StringBuilder buffer = new StringBuilder(this.hostname.length() + 6);
+            buffer.append(this.hostname);
+            buffer.append(":");
+            buffer.append(Integer.toString(this.port));
+            return buffer.toString();
+        } else {
+            return this.hostname;
+        }
+    }
+
+
+    @Override
+    public String toString() {
+        return toURI();
+    }
+
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof CXFHttpHost) {
+            CXFHttpHost that = (CXFHttpHost) obj;
+            boolean b = this.lcHostname.equals(that.lcHostname)
+                && this.port == that.port
+                && this.schemeName.equals(that.schemeName);
+            if ("https".equals(schemeName)) {
+                b &= tlsInfo.equals(that.tlsInfo);
+            } else {
+                b &= that.tlsInfo == null;
+            }
+            if (proxy != null) {
+                b &= proxy.equals(that.proxy);
+            } else {
+                b &= that.proxy == null;
+            }
+            return b;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() { 
+        return hashcode;
+    }
+    private int computeHash() {
+        int hash = LangUtils.HASH_SEED;
+        hash = LangUtils.hashCode(hash, this.lcHostname);
+        hash = LangUtils.hashCode(hash, this.port);
+        hash = LangUtils.hashCode(hash, this.schemeName);
+        if ("https".equals(schemeName)) {
+            hash = LangUtils.hashCode(hash, tlsInfo);
+        }
+        if (proxy != null) {
+            hash = LangUtils.hashCode(hash, proxy);
+        }
+        return hash;
+    }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
+    }
+
+}

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpRequest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpRequest.java?rev=1381308&r1=1381307&r2=1381308&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpRequest.java (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFHttpRequest.java Wed Sep  5 19:18:34 2012
@@ -21,6 +21,7 @@ package org.apache.cxf.transport.http.as
 
 import java.net.URI;
 
+import org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit.AsyncWrappedOutputStream;
 import org.apache.http.Header;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
@@ -31,18 +32,26 @@ import org.apache.http.message.AbstractH
 import org.apache.http.message.BasicRequestLine;
 import org.apache.http.protocol.HTTP;
 
-class CXFHttpRequest extends AbstractHttpMessage implements HttpEntityEnclosingRequest {
+public class CXFHttpRequest extends AbstractHttpMessage implements HttpEntityEnclosingRequest {
 
     private final String method;
     
     private URI uri;
     private HttpEntity entity;
+    private AsyncWrappedOutputStream out;
 
     public CXFHttpRequest(final String method) {
         super();
         this.method = method;
     }
     
+
+    public void setOutputStream(AsyncWrappedOutputStream o) {
+        out = o;
+    }
+    public AsyncWrappedOutputStream getOutputStream() {
+        return out;
+    }
     public URI getURI() {
         return uri;
     }

Added: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFConnectionFactory.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFConnectionFactory.java?rev=1381308&view=auto
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFConnectionFactory.java (added)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFConnectionFactory.java Wed Sep  5 19:18:34 2012
@@ -0,0 +1,167 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.transport.http.asyncclient.impl;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.util.logging.Logger;
+
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLException;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.X509KeyManager;
+
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.jsse.SSLUtils;
+import org.apache.cxf.configuration.jsse.TLSClientParameters;
+import org.apache.cxf.transport.http.asyncclient.CXFConnection;
+import org.apache.cxf.transport.http.asyncclient.CXFHttpHost;
+import org.apache.cxf.transport.http.asyncclient.CXFHttpRequest;
+import org.apache.cxf.transport.https.AliasedX509ExtendedKeyManager;
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.impl.DefaultHttpResponseFactory;
+import org.apache.http.impl.nio.DefaultNHttpClientConnection;
+import org.apache.http.nio.NHttpClientConnection;
+import org.apache.http.nio.NHttpConnectionFactory;
+import org.apache.http.nio.pool.NIOConnFactory;
+import org.apache.http.nio.reactor.IOEventDispatch;
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.reactor.ssl.SSLIOSession;
+import org.apache.http.nio.reactor.ssl.SSLMode;
+import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
+import org.apache.http.nio.util.ByteBufferAllocator;
+import org.apache.http.nio.util.HeapByteBufferAllocator;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+
+public class CXFConnectionFactory
+    implements NHttpConnectionFactory<DefaultNHttpClientConnection>,
+        NIOConnFactory<CXFHttpHost, NHttpClientConnection> {
+    
+    private static final Logger LOG = LogUtils.getL7dLogger(CXFConnectionFactory.class); 
+    
+    private final HttpResponseFactory responseFactory = new DefaultHttpResponseFactory();
+    private final ByteBufferAllocator allocator = new HeapByteBufferAllocator();
+    private final HttpParams params;
+
+    public CXFConnectionFactory(final HttpParams params) {
+        this.params = params;
+    }
+
+    public DefaultNHttpClientConnection createConnection(IOSession session) {
+        final CXFHttpHost host = (CXFHttpHost)session.getAttribute("http.session.attachment");
+        try {
+            return (DefaultNHttpClientConnection)createConnection(host, session);
+        } catch (IOException e) {
+            return null;
+        }
+    }
+
+    
+    protected void getKeyManagersWithCertAlias(TLSClientParameters tlsClientParameters,
+                                               KeyManager[] keyManagers) throws GeneralSecurityException {
+        if (tlsClientParameters.getCertAlias() != null) {
+            for (int idx = 0; idx < keyManagers.length; idx++) {
+                if (keyManagers[idx] instanceof X509KeyManager) {
+                    try {
+                        keyManagers[idx] = new AliasedX509ExtendedKeyManager(
+                            tlsClientParameters.getCertAlias(), (X509KeyManager)keyManagers[idx]);
+                    } catch (Exception e) {
+                        throw new GeneralSecurityException(e);
+                    }
+                }
+            }
+        }
+    }
+
+    public SSLContext getSSLContext(CXFHttpHost target) throws GeneralSecurityException {
+        TLSClientParameters tlsClientParameters = target.getTlsClientParameters();
+        if (tlsClientParameters == null) {
+            tlsClientParameters = new TLSClientParameters();
+        }
+        String provider = tlsClientParameters.getJsseProvider();
+
+        String protocol = tlsClientParameters.getSecureSocketProtocol() != null ? tlsClientParameters
+            .getSecureSocketProtocol() : "TLS";
+
+        SSLContext ctx = provider == null ? SSLContext.getInstance(protocol) : SSLContext
+            .getInstance(protocol, provider);
+        ctx.getClientSessionContext().setSessionTimeout(tlsClientParameters.getSslCacheTimeout());
+        KeyManager[] keyManagers = tlsClientParameters.getKeyManagers();
+        if (tlsClientParameters.getCertAlias() != null) {
+            getKeyManagersWithCertAlias(tlsClientParameters, keyManagers);
+        }
+        ctx.init(keyManagers, tlsClientParameters.getTrustManagers(),
+                 tlsClientParameters.getSecureRandom());
+
+        return ctx;
+    }
+    public void initializeSSLEngine(CXFHttpHost target, SSLContext ctx, SSLEngine sslengine) {
+        TLSClientParameters tlsClientParameters = target.getTlsClientParameters();
+        if (tlsClientParameters == null) {
+            tlsClientParameters = new TLSClientParameters();
+        }
+        String[] cipherSuites = SSLUtils.getCiphersuites(tlsClientParameters.getCipherSuites(),
+                                                         SSLUtils.getSupportedCipherSuites(ctx), 
+                                                         tlsClientParameters.getCipherSuitesFilter(), LOG, false);
+        sslengine.setEnabledCipherSuites(cipherSuites);
+    }
+
+    @Override
+    public NHttpClientConnection create(final CXFHttpHost route, IOSession session) throws IOException {
+        //return new CXFConnection(session, responseFactory, allocator, params);
+        return createConnection(route, session);
+    }
+
+    public NHttpClientConnection createConnection(final CXFHttpHost route, IOSession session) throws IOException {
+        if ("https".equals(route.getSchemeName())) {
+            try {
+                final SSLContext sslcontext = getSSLContext(route);
+                SSLIOSession ssliosession 
+                    = new SSLIOSession(session, SSLMode.CLIENT, sslcontext, new SSLSetupHandler() {
+                        public void initalize(SSLEngine sslengine) throws SSLException {
+                            initializeSSLEngine(route, sslcontext, sslengine);
+                        }
+                        public void verify(IOSession iosession, SSLSession sslsession) throws SSLException {
+                            iosession.setAttribute("cxf.handshake.done", Boolean.TRUE);
+                            CXFHttpRequest req = (CXFHttpRequest)iosession
+                                .removeAttribute(CXFHttpRequest.class.getName());
+                            if (req != null) {
+                                req.getOutputStream().verify(sslsession);
+                            }
+                        }
+                    });
+                session.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
+                session = ssliosession;
+            } catch (GeneralSecurityException e) {
+                throw new RuntimeException(e);
+            }
+        }
+        CXFConnection conn = new CXFConnection(session, responseFactory, allocator, params);
+        int timeout = HttpConnectionParams.getSoTimeout(this.params);
+        conn.setSocketTimeout(timeout);
+        session.setAttribute(IOEventDispatch.CONNECTION_KEY, conn);
+        return conn;
+    }
+    
+}

Added: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFNIOConnectionPool.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFNIOConnectionPool.java?rev=1381308&view=auto
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFNIOConnectionPool.java (added)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFNIOConnectionPool.java Wed Sep  5 19:18:34 2012
@@ -0,0 +1,108 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.transport.http.asyncclient.impl;
+
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.cxf.transport.http.asyncclient.CXFHttpHost;
+import org.apache.http.annotation.ThreadSafe;
+import org.apache.http.concurrent.FutureCallback;
+import org.apache.http.nio.NHttpClientConnection;
+import org.apache.http.nio.pool.AbstractNIOConnPool;
+import org.apache.http.nio.reactor.ConnectingIOReactor;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+
+/**
+ * A very basic {@link ConnPool} implementation that represents a pool
+ * of non-blocking {@link NHttpClientConnection} connections identified by
+ * an {@link HttpHost} instance. Please note this pool implementation
+ * does not support complex routes via a proxy cannot differentiate between
+ * direct and proxied connections.
+ * <p>
+ * The following parameters can be used to customize the behavior of this
+ * class:
+ * <ul>
+ *  <li>{@link org.apache.http.params.CoreProtocolPNames#HTTP_ELEMENT_CHARSET}</li>
+ *  <li>{@link org.apache.http.params.CoreConnectionPNames#SO_TIMEOUT}</li>
+ *  <li>{@link org.apache.http.params.CoreConnectionPNames#CONNECTION_TIMEOUT}</li>
+ *  <li>{@link org.apache.http.params.CoreConnectionPNames#SOCKET_BUFFER_SIZE}</li>
+ *  <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_HEADER_COUNT}</li>
+ *  <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_LINE_LENGTH}</li>
+ * </ul>
+ *
+ * @see HttpHost
+ * @since 4.2
+ */
+@ThreadSafe
+public class CXFNIOConnectionPool extends AbstractNIOConnPool<CXFHttpHost, NHttpClientConnection, CXFNIOPoolEntry> {
+
+    private static final AtomicLong COUNTER = new AtomicLong();
+
+    private final HttpParams params;
+    
+    public CXFNIOConnectionPool(
+            final ConnectingIOReactor ioreactor,
+            final CXFConnectionFactory connFactory,
+            final HttpParams params) {
+        super(ioreactor, connFactory, 2, 20);
+        if (params == null) {
+            throw new IllegalArgumentException("HTTP parameters may not be null");
+        }
+        this.params = params;
+    }
+
+    @Override
+    protected SocketAddress resolveRemoteAddress(final CXFHttpHost host) {
+        return new InetSocketAddress(host.getHostName(), host.getPort());
+    }
+
+    @Override
+    protected SocketAddress resolveLocalAddress(final CXFHttpHost host) {
+        return null;
+    }
+
+    @Override
+    protected CXFNIOPoolEntry createEntry(final CXFHttpHost host, final NHttpClientConnection conn) {
+        return new CXFNIOPoolEntry(Long.toString(COUNTER.getAndIncrement()), host, conn);
+    }
+
+    @Override
+    public Future<CXFNIOPoolEntry> lease(
+            final CXFHttpHost route,
+            final Object state,
+            final FutureCallback<CXFNIOPoolEntry> callback) {
+        int connectTimeout = HttpConnectionParams.getConnectionTimeout(this.params);
+        return super.lease(route, state, connectTimeout, TimeUnit.MILLISECONDS, callback);
+    }
+
+    @Override
+    public Future<CXFNIOPoolEntry> lease(
+            final CXFHttpHost route,
+            final Object state) {
+        int connectTimeout = HttpConnectionParams.getConnectionTimeout(this.params);
+        return super.lease(route, state, connectTimeout, TimeUnit.MILLISECONDS, null);
+    }
+
+}
\ No newline at end of file

Added: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFNIOPoolEntry.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFNIOPoolEntry.java?rev=1381308&view=auto
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFNIOPoolEntry.java (added)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/CXFNIOPoolEntry.java Wed Sep  5 19:18:34 2012
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.transport.http.asyncclient.impl;
+
+import java.io.IOException;
+
+import org.apache.cxf.transport.http.asyncclient.CXFHttpHost;
+import org.apache.http.nio.NHttpClientConnection;
+import org.apache.http.pool.PoolEntry;
+
+public class CXFNIOPoolEntry extends PoolEntry<CXFHttpHost, NHttpClientConnection> {
+
+    public CXFNIOPoolEntry(final String id, final CXFHttpHost route, final NHttpClientConnection conn) {
+        super(id, route, conn);
+    }
+    public void close() {
+        try {
+            getConnection().close();
+        } catch (IOException ignore) {
+            //ignore
+        }
+    }
+    public boolean isClosed() {
+        return !getConnection().isOpen();
+    }
+}
\ No newline at end of file

Added: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/package-info.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/package-info.java?rev=1381308&view=auto
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/package-info.java (added)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/impl/package-info.java Wed Sep  5 19:18:34 2012
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Package that contains a bunch of stuff that are subclasses
+ * of the various abstract functional pieces of HC, but uses the 
+ * CXFHttpHost instead of the HttpHost that HC provides.
+ */
+package org.apache.cxf.transport.http.asyncclient.impl;
\ No newline at end of file



Mime
View raw message