Author: asankha
Date: Thu Mar 15 10:36:08 2007
New Revision: 518701

URL: http://svn.apache.org/viewvc?view=rev&rev=518701
Log:
Apply patch from Oleg for enhanced logging of HttpCore classes used by the 
nhttp transport 
https://issues.apache.org/jira/browse/SYNAPSE-70

Thanks Oleg

Added:
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java
Modified:
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOListener.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLListener.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLSender.java
    
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOListener.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOListener.java?view=diff&rev=518701&r1=518700&r2=518701
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOListener.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOListener.java
 Thu Mar 15 10:36:08 2007
@@ -15,31 +15,30 @@
 */
 package org.apache.axis2.transport.nhttp;
 
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+
+import javax.net.ssl.SSLContext;
+
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.transport.TransportListener;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpConnectionParams;
-import org.apache.http.params.HttpProtocolParams;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.nio.reactor.IOEventDispatch;
-import org.apache.http.nio.reactor.ListeningIOReactor;
-import org.apache.http.nio.NHttpServiceHandler;
 import org.apache.http.impl.nio.reactor.DefaultListeningIOReactor;
 import org.apache.http.impl.nio.reactor.SSLIOSessionHandler;
-import org.apache.http.impl.nio.DefaultServerIOEventDispatch;
-
-import javax.net.ssl.SSLContext;
-import java.io.InterruptedIOException;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
+import org.apache.http.nio.NHttpServiceHandler;
+import org.apache.http.nio.reactor.IOEventDispatch;
+import org.apache.http.nio.reactor.ListeningIOReactor;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.HttpProtocolParams;
 
 /**
  * NIO transport listener for Axis2 based on HttpCore and NIO extensions
@@ -94,7 +93,7 @@
     protected IOEventDispatch getEventDispatch(
         NHttpServiceHandler handler, SSLContext sslContext, 
         SSLIOSessionHandler sslioSessionHandler, HttpParams params) {
-        return new DefaultServerIOEventDispatch(handler, params);
+        return new PlainServerIOEventDispatch(handler, params);
     }
 
     /**

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLListener.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLListener.java?view=diff&rev=518701&r1=518700&r2=518701
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLListener.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLListener.java
 Thu Mar 15 10:36:08 2007
@@ -1,26 +1,32 @@
 package org.apache.axis2.transport.nhttp;
 
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
+import java.io.IOException;
+import java.net.SocketAddress;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLException;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axiom.om.OMElement;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.http.impl.nio.reactor.SSLServerIOEventDispatch;
 import org.apache.http.impl.nio.reactor.SSLIOSessionHandler;
-import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.NHttpServiceHandler;
+import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.params.HttpParams;
-
-import javax.net.ssl.*;
-import javax.xml.namespace.QName;
-import java.security.KeyStore;
-import java.security.GeneralSecurityException;
-import java.net.URL;
-import java.net.SocketAddress;
-import java.io.IOException;
 
 public class HttpCoreNIOSSLListener extends HttpCoreNIOListener {
 

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLSender.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLSender.java?view=diff&rev=518701&r1=518700&r2=518701
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLSender.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLSender.java
 Thu Mar 15 10:36:08 2007
@@ -4,7 +4,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.NHttpClientHandler;
-import org.apache.http.impl.nio.reactor.SSLClientIOEventDispatch;
 import org.apache.http.impl.nio.reactor.SSLIOSessionHandler;
 import org.apache.http.params.HttpParams;
 import org.apache.axis2.AxisFault;

Modified: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java?view=diff&rev=518701&r1=518700&r2=518701
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java
 Thu Mar 15 10:36:08 2007
@@ -15,51 +15,48 @@
 */
 package org.apache.axis2.transport.nhttp;
 
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.net.ssl.SSLContext;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.RelatesTo;
+import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.transport.OutTransportInfo;
-import org.apache.axiom.om.OMOutputFormat;
-import org.apache.http.nio.NHttpClientHandler;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpResponse;
+import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
+import org.apache.http.impl.nio.reactor.SSLIOSessionHandler;
 import org.apache.http.nio.NHttpClientConnection;
+import org.apache.http.nio.NHttpClientHandler;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.reactor.SessionRequest;
 import org.apache.http.nio.reactor.SessionRequestCallback;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpHost;
-import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
-import org.apache.http.impl.nio.reactor.SSLIOSessionHandler;
-import org.apache.http.impl.nio.DefaultClientIOEventDispatch;
-import org.apache.http.params.HttpParams;
+import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
-import org.apache.http.params.BasicHttpParams;
 import org.apache.http.protocol.HTTP;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.xml.stream.XMLStreamException;
-import javax.net.ssl.SSLContext;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.InetSocketAddress;
-import java.util.Map;
-import java.util.Iterator;
 
 /**
  * NIO transport sender for Axis2 based on HttpCore and NIO extensions
@@ -141,7 +138,7 @@
     protected IOEventDispatch getEventDispatch(
         NHttpClientHandler handler, SSLContext sslContext,
         SSLIOSessionHandler sslIOSessionHandler, HttpParams params) {
-        return new DefaultClientIOEventDispatch(handler, params);
+        return new PlainClientIOEventDispatch(handler, params);
     }
 
     /**
@@ -261,7 +258,7 @@
             NHttpClientConnection conn = 
ConnectionPool.getConnection(url.getHost(), port);
 
             if (conn == null) {
-                SessionRequest req = ioReactor.connect(new 
InetSocketAddress(url.getHost(), port),
+                ioReactor.connect(new InetSocketAddress(url.getHost(), port),
                     null, axis2Req, sessionRequestCallback);
                 log.debug("A new connection established");
             } else {

Added: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java?view=auto&rev=518701
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
 (added)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
 Thu Mar 15 10:36:08 2007
@@ -0,0 +1,178 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed 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.axis2.transport.nhttp;
+
+import java.io.IOException;
+import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.ByteChannel;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.reactor.SessionBufferStatus;
+
+/**
+ * Decorator class intended to transparently extend an [EMAIL PROTECTED] 
IOSession} 
+ * with basic event logging capabilities using Commons Logging. 
+ */
+public class LoggingIOSession implements IOSession {
+
+    private static int COUNT = 0;
+    
+    private final Log log;
+    private final IOSession session;
+    private final ByteChannel channel;
+    private final int id;
+    
+    public LoggingIOSession(final IOSession session) {
+        super();
+        if (session == null) {
+            throw new IllegalArgumentException("I/O session may not be null");
+        }
+        this.session = session;
+        this.channel = new LoggingByteChannel();
+        this.id = ++COUNT;
+        this.log = LogFactory.getLog(session.getClass());
+    }
+
+    public ByteChannel channel() {
+        return this.channel;
+    }
+
+    public SocketAddress getLocalAddress() {
+        return this.session.getLocalAddress();
+    }
+
+    public SocketAddress getRemoteAddress() {
+        return this.session.getRemoteAddress();
+    }
+
+    public int getEventMask() {
+        return this.session.getEventMask();
+    }
+
+    public void setEventMask(int ops) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("I/O session " + this.id + " " + this.session + ": 
Set event mask " 
+                    + ops);
+        }
+        this.session.setEventMask(ops);
+    }
+
+    public void setEvent(int op) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("I/O session " + this.id + " " + this.session + ": 
Set event " 
+                    + op);
+        }
+        this.session.setEvent(op);
+    }
+
+    public void clearEvent(int op) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("I/O session " + this.id + " " + this.session + ": 
Clear event " 
+                    + op);
+        }
+        this.session.clearEvent(op);
+    }
+
+    public void close() {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("I/O session " + this.id + " " + this.session + ": 
Close");
+        }
+        this.session.close();
+    }
+
+    public boolean isClosed() {
+        return this.session.isClosed();
+    }
+
+    public int getSocketTimeout() {
+        return this.session.getSocketTimeout();
+    }
+
+    public void setSocketTimeout(int timeout) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("I/O session " + this.id + " " + this.session + ": 
Set timeout " 
+                    + timeout);
+        }
+        this.session.setSocketTimeout(timeout);
+    }
+
+    public void setBufferStatus(final SessionBufferStatus status) {
+        this.session.setBufferStatus(status);
+    }
+
+    public boolean hasBufferedInput() {
+        return this.session.hasBufferedInput();
+    }
+
+    public boolean hasBufferedOutput() {
+        return this.session.hasBufferedOutput();
+    }
+
+    public Object getAttribute(final String name) {
+        return this.session.getAttribute(name);
+    }
+
+    public void setAttribute(final String name, final Object obj) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("I/O session " + this.id + " " + this.session + ": 
Set attribute " 
+                    + name);
+        }
+        this.session.setAttribute(name, obj);
+    }
+
+    public Object removeAttribute(final String name) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("I/O session " + this.id + " " + this.session + ": 
Remove attribute " 
+                    + name);
+        }
+        return this.session.removeAttribute(name);
+    }
+
+    class LoggingByteChannel implements ByteChannel {
+
+        public int read(final ByteBuffer dst) throws IOException {
+            int bytesRead = session.channel().read(dst);
+            if (log.isDebugEnabled()) {
+                log.debug("I/O session " + id + " " + session + ": " + 
bytesRead + " bytes read");
+            }
+            return bytesRead;
+        }
+
+        public int write(final ByteBuffer src) throws IOException {
+            int byteWritten = session.channel().write(src);
+            if (log.isDebugEnabled()) {
+                log.debug("I/O session " + id + " " + session + ": " + 
byteWritten + " bytes written");
+            }
+            return byteWritten;
+        }
+
+        public void close() throws IOException {
+            if (log.isDebugEnabled()) {
+                log.debug("I/O session " + id + " " + session + ": Channel 
close");
+            }
+            session.channel().close();
+        }
+
+        public boolean isOpen() {
+            return session.channel().isOpen();
+        }
+        
+    }    
+    
+}
\ No newline at end of file

Added: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java?view=auto&rev=518701
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java
 (added)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpClientHandler.java
 Thu Mar 15 10:36:08 2007
@@ -0,0 +1,113 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed 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.axis2.transport.nhttp;
+
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.HttpException;
+import org.apache.http.HttpResponse;
+import org.apache.http.nio.ContentDecoder;
+import org.apache.http.nio.ContentEncoder;
+import org.apache.http.nio.NHttpClientConnection;
+import org.apache.http.nio.NHttpClientHandler;
+
+/**
+ * Decorator class intended to transparently extend an [EMAIL PROTECTED] 
NHttpClientHandler} 
+ * with basic event logging capabilities using Commons Logging. 
+ */
+public class LoggingNHttpClientHandler implements NHttpClientHandler {
+
+    private final Log log;
+    private final NHttpClientHandler handler;
+    
+    public LoggingNHttpClientHandler(final NHttpClientHandler handler) {
+        super();
+        if (handler == null) {
+            throw new IllegalArgumentException("HTTP client handler may not be 
null");
+        }
+        this.handler = handler;
+        this.log = LogFactory.getLog(handler.getClass());
+    }
+    
+    public void connected(final NHttpClientConnection conn, final Object 
attachment) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Connected (" + 
attachment + ")");
+        }
+        this.handler.connected(conn, attachment);
+    }
+
+    public void closed(final NHttpClientConnection conn) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Closed");
+        }
+        this.handler.closed(conn);
+    }
+
+    public void exception(final NHttpClientConnection conn, final IOException 
ex) {
+        this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex);
+        this.handler.exception(conn, ex);
+    }
+
+    public void exception(final NHttpClientConnection conn, final 
HttpException ex) {
+        this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex);
+        this.handler.exception(conn, ex);
+    }
+
+    public void requestReady(final NHttpClientConnection conn) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Request ready");
+        }
+        this.handler.requestReady(conn);
+    }
+
+    public void outputReady(final NHttpClientConnection conn, final 
ContentEncoder encoder) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Output ready");
+        }
+        this.handler.outputReady(conn, encoder);
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Content encoder " + 
encoder);
+        }
+    }
+
+    public void responseReceived(final NHttpClientConnection conn) {
+        if (this.log.isDebugEnabled()) {
+            HttpResponse response = conn.getHttpResponse();
+            this.log.debug("HTTP connection " + conn + ": " + 
response.getStatusLine());
+        }
+        this.handler.responseReceived(conn);
+    }
+
+    public void inputReady(final NHttpClientConnection conn, final 
ContentDecoder decoder) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Input ready");
+        }
+        this.handler.inputReady(conn, decoder);
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Content decoder " + 
decoder);
+        }
+    }
+
+    public void timeout(final NHttpClientConnection conn) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Timeout");
+        }
+        this.handler.timeout(conn);
+    }
+
+}
\ No newline at end of file

Added: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java?view=auto&rev=518701
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java
 (added)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/LoggingNHttpServiceHandler.java
 Thu Mar 15 10:36:08 2007
@@ -0,0 +1,113 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed 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.axis2.transport.nhttp;
+
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.HttpException;
+import org.apache.http.HttpRequest;
+import org.apache.http.nio.ContentDecoder;
+import org.apache.http.nio.ContentEncoder;
+import org.apache.http.nio.NHttpServerConnection;
+import org.apache.http.nio.NHttpServiceHandler;
+
+/**
+ * Decorator class intended to transparently extend an [EMAIL PROTECTED] 
NHttpServiceHandler} 
+ * with basic event logging capabilities using Commons Logging. 
+ */
+public class LoggingNHttpServiceHandler implements NHttpServiceHandler {
+
+    private final Log log;
+    private final NHttpServiceHandler handler;
+    
+    public LoggingNHttpServiceHandler(final NHttpServiceHandler handler) {
+        super();
+        if (handler == null) {
+            throw new IllegalArgumentException("HTTP service handler may not 
be null");
+        }
+        this.handler = handler;
+        this.log = LogFactory.getLog(handler.getClass());
+    }
+    
+    public void connected(final NHttpServerConnection conn) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Connected");
+        }
+        this.handler.connected(conn);
+    }
+
+    public void closed(final NHttpServerConnection conn) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Closed");
+        }
+        this.handler.closed(conn);
+    }
+
+    public void exception(final NHttpServerConnection conn, final IOException 
ex) {
+        this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex);
+        this.handler.exception(conn, ex);
+    }
+
+    public void exception(final NHttpServerConnection conn, final 
HttpException ex) {
+        this.log.error("HTTP connection " + conn + ": " + ex.getMessage(), ex);
+        this.handler.exception(conn, ex);
+    }
+
+    public void requestReceived(final NHttpServerConnection conn) {
+        if (this.log.isDebugEnabled()) {
+            HttpRequest request = conn.getHttpRequest();
+            this.log.debug("HTTP connection " + conn + ": " + 
request.getRequestLine());
+        }
+        this.handler.requestReceived(conn);
+    }
+
+    public void outputReady(final NHttpServerConnection conn, final 
ContentEncoder encoder) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Output ready");
+        }
+        this.handler.outputReady(conn, encoder);
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Content encoder " + 
encoder);
+        }
+    }
+
+    public void responseReady(final NHttpServerConnection conn) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Response ready");
+        }
+        this.handler.responseReady(conn);
+    }
+
+    public void inputReady(final NHttpServerConnection conn, final 
ContentDecoder decoder) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Input ready");
+        }
+        this.handler.inputReady(conn, decoder);
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Content decoder " + 
decoder);
+        }
+    }
+
+    public void timeout(final NHttpServerConnection conn) {
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + conn + ": Timeout");
+        }
+        this.handler.timeout(conn);
+    }
+
+}
\ No newline at end of file

Added: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java?view=auto&rev=518701
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java
 (added)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainClientIOEventDispatch.java
 Thu Mar 15 10:36:08 2007
@@ -0,0 +1,81 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed 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.axis2.transport.nhttp;
+
+import org.apache.http.impl.DefaultHttpResponseFactory;
+import org.apache.http.impl.nio.DefaultNHttpClientConnection;
+import org.apache.http.nio.NHttpClientHandler;
+import org.apache.http.nio.reactor.IOEventDispatch;
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.params.HttpParams;
+
+public class PlainClientIOEventDispatch implements IOEventDispatch {
+
+    private static final String NHTTP_CONN = "SYNAPSE.NHTTP_CONN";
+    
+    private final NHttpClientHandler handler;
+    private final HttpParams params;
+    
+    public PlainClientIOEventDispatch(final NHttpClientHandler handler, final 
HttpParams params) {
+        super();
+        if (handler == null) {
+            throw new IllegalArgumentException("HTTP client handler may not be 
null");
+        }
+        if (params == null) {
+            throw new IllegalArgumentException("HTTP parameters may not be 
null");
+        }
+        // Decorate client handler with logging capabilities
+        this.handler = new LoggingNHttpClientHandler(handler);
+        this.params = params;
+    }
+    
+    public void connected(final IOSession session) {
+        // Decorate I/O session with logging capabilities
+        DefaultNHttpClientConnection conn = new DefaultNHttpClientConnection(
+                new LoggingIOSession(session), 
+                new DefaultHttpResponseFactory(),
+                this.params); 
+        session.setAttribute(NHTTP_CONN, conn);
+        
+        Object attachment = session.getAttribute(IOSession.ATTACHMENT_KEY);
+        this.handler.connected(conn, attachment);
+    }
+
+    public void disconnected(final IOSession session) {
+        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        this.handler.closed(conn);
+    }
+
+    public void inputReady(final IOSession session) {
+        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        conn.consumeInput(this.handler);
+    }
+
+    public void outputReady(final IOSession session) {
+        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        conn.produceOutput(this.handler);
+    }
+
+    public void timeout(final IOSession session) {
+        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        this.handler.timeout(conn);
+    }
+
+}

Added: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java?view=auto&rev=518701
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java
 (added)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/PlainServerIOEventDispatch.java
 Thu Mar 15 10:36:08 2007
@@ -0,0 +1,79 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed 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.axis2.transport.nhttp;
+
+import org.apache.http.impl.DefaultHttpRequestFactory;
+import org.apache.http.impl.nio.DefaultNHttpServerConnection;
+import org.apache.http.nio.NHttpServiceHandler;
+import org.apache.http.nio.reactor.IOEventDispatch;
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.params.HttpParams;
+
+public class PlainServerIOEventDispatch implements IOEventDispatch {
+
+    private static final String NHTTP_CONN = "SYNAPSE.NHTTP_CONN";
+    
+    private final NHttpServiceHandler handler;
+    private final HttpParams params;
+    
+    public PlainServerIOEventDispatch(final NHttpServiceHandler handler, final 
HttpParams params) {
+        super();
+        if (handler == null) {
+            throw new IllegalArgumentException("HTTP service handler may not 
be null");
+        }
+        if (params == null) {
+            throw new IllegalArgumentException("HTTP parameters may not be 
null");
+        }
+        // Decorate service handler with logging capabilities
+        this.handler = new LoggingNHttpServiceHandler(handler);
+        this.params = params;
+    }
+    
+    public void connected(final IOSession session) {
+        // Decorate I/O session with logging capabilities
+        DefaultNHttpServerConnection conn = new DefaultNHttpServerConnection(
+                new LoggingIOSession(session), 
+                new DefaultHttpRequestFactory(),
+                this.params); 
+        session.setAttribute(NHTTP_CONN, conn);
+        this.handler.connected(conn);
+    }
+
+    public void disconnected(final IOSession session) {
+        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        this.handler.closed(conn);
+    }
+
+    public void inputReady(final IOSession session) {
+        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        conn.consumeInput(this.handler);
+    }
+
+    public void outputReady(final IOSession session) {
+        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        conn.produceOutput(this.handler);
+    }
+
+    public void timeout(final IOSession session) {
+        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        this.handler.timeout(conn);
+    }
+
+}

Added: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java?view=auto&rev=518701
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java
 (added)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLClientIOEventDispatch.java
 Thu Mar 15 10:36:08 2007
@@ -0,0 +1,154 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed 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.axis2.transport.nhttp;
+
+import java.io.IOException;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLException;
+
+import org.apache.http.impl.DefaultHttpResponseFactory;
+import org.apache.http.impl.nio.DefaultNHttpClientConnection;
+import org.apache.http.impl.nio.reactor.SSLIOSession;
+import org.apache.http.impl.nio.reactor.SSLIOSessionHandler;
+import org.apache.http.impl.nio.reactor.SSLMode;
+import org.apache.http.nio.NHttpClientHandler;
+import org.apache.http.nio.reactor.IOEventDispatch;
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.params.HttpParams;
+
+public class SSLClientIOEventDispatch implements IOEventDispatch {
+
+    private static final String NHTTP_CONN = "SYNAPSE.NHTTP_CONN";
+    private static final String SSL_SESSION = "SYNAPSE.SSL_SESSION";
+    
+    private final NHttpClientHandler handler;
+    private final HttpParams params;
+    private final SSLContext sslcontext;
+    private final SSLIOSessionHandler sslHandler;
+    
+    public SSLClientIOEventDispatch(
+            final NHttpClientHandler handler,
+            final SSLContext sslcontext,
+            final SSLIOSessionHandler sslHandler,
+            final HttpParams params) {
+        super();
+        if (handler == null) {
+            throw new IllegalArgumentException("HTTP client handler may not be 
null");
+        }
+        if (sslcontext == null) {
+            throw new IllegalArgumentException("SSL context may not be null");
+        }
+        if (params == null) {
+            throw new IllegalArgumentException("HTTP parameters may not be 
null");
+        }
+        this.handler = new LoggingNHttpClientHandler(handler);
+        this.params = params;
+        this.sslcontext = sslcontext;
+        this.sslHandler = sslHandler;
+    }
+    
+    public SSLClientIOEventDispatch(
+            final NHttpClientHandler handler,
+            final SSLContext sslcontext,
+            final HttpParams params) {
+        this(handler, sslcontext, null, params);
+    }
+    
+    public void connected(final IOSession session) {
+
+        SSLIOSession sslSession = new SSLIOSession(
+                session, 
+                this.sslcontext,
+                this.sslHandler); 
+        
+        DefaultNHttpClientConnection conn = new DefaultNHttpClientConnection(
+                new LoggingIOSession(sslSession), 
+                new DefaultHttpResponseFactory(),
+                this.params); 
+        
+        session.setAttribute(NHTTP_CONN, conn);
+        session.setAttribute(SSL_SESSION, sslSession);
+        
+        Object attachment = session.getAttribute(IOSession.ATTACHMENT_KEY);
+        this.handler.connected(conn, attachment);
+
+        try {
+            sslSession.initialize(SSLMode.CLIENT, this.params);
+        } catch (SSLException ex) {
+            this.handler.exception(conn, ex);
+            sslSession.shutdown();
+        }
+    }
+
+    public void disconnected(final IOSession session) {
+        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        
+        this.handler.closed(conn);
+    }
+
+    public void inputReady(final IOSession session) {
+        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        SSLIOSession sslSession = (SSLIOSession) session.getAttribute(
+                SSL_SESSION);
+        try {
+            synchronized (sslSession) {
+                while (sslSession.isAppInputReady()) {
+                    conn.consumeInput(this.handler);
+                }
+                sslSession.inboundTransport();
+            }
+        } catch (IOException ex) {
+            this.handler.exception(conn, ex);
+            sslSession.shutdown();
+        }
+    }
+
+    public void outputReady(final IOSession session) {
+        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        SSLIOSession sslSession = (SSLIOSession) session.getAttribute(
+                SSL_SESSION);
+        try {
+            synchronized (sslSession) {
+                if (sslSession.isAppOutputReady()) {
+                    conn.produceOutput(this.handler);
+                }
+                sslSession.outboundTransport();
+            }
+        } catch (IOException ex) {
+            this.handler.exception(conn, ex);
+            sslSession.shutdown();
+        }
+    }
+
+    public void timeout(final IOSession session) {
+        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        SSLIOSession sslSession = (SSLIOSession) session.getAttribute(
+                SSL_SESSION);
+        this.handler.timeout(conn);
+        synchronized (sslSession) {
+            if (sslSession.isOutboundDone() && !sslSession.isInboundDone()) {
+                // The session failed to terminate cleanly 
+                sslSession.shutdown();
+            }
+        }
+    }
+
+}

Added: 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java?view=auto&rev=518701
==============================================================================
--- 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java
 (added)
+++ 
webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/SSLServerIOEventDispatch.java
 Thu Mar 15 10:36:08 2007
@@ -0,0 +1,152 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed 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.axis2.transport.nhttp;
+
+import java.io.IOException;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLException;
+
+import org.apache.http.impl.DefaultHttpRequestFactory;
+import org.apache.http.impl.nio.DefaultNHttpServerConnection;
+import org.apache.http.impl.nio.reactor.SSLIOSession;
+import org.apache.http.impl.nio.reactor.SSLIOSessionHandler;
+import org.apache.http.impl.nio.reactor.SSLMode;
+import org.apache.http.nio.NHttpServiceHandler;
+import org.apache.http.nio.reactor.IOEventDispatch;
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.params.HttpParams;
+
+public class SSLServerIOEventDispatch implements IOEventDispatch {
+
+    private static final String NHTTP_CONN = "SYNAPSE.NHTTP_CONN";
+    private static final String SSL_SESSION = "SYNAPSE.SSL_SESSION";
+   
+    private final NHttpServiceHandler handler;
+    private final SSLContext sslcontext;
+    private final SSLIOSessionHandler sslHandler;
+    private final HttpParams params;
+    
+    public SSLServerIOEventDispatch(
+            final NHttpServiceHandler handler,
+            final SSLContext sslcontext,
+            final SSLIOSessionHandler sslHandler,
+            final HttpParams params) {
+        super();
+        if (handler == null) {
+            throw new IllegalArgumentException("HTTP service handler may not 
be null");
+        }
+        if (sslcontext == null) {
+            throw new IllegalArgumentException("SSL context may not be null");
+        }
+        if (params == null) {
+            throw new IllegalArgumentException("HTTP parameters may not be 
null");
+        }
+        this.handler = new LoggingNHttpServiceHandler(handler);
+        this.params = params;
+        this.sslcontext = sslcontext;
+        this.sslHandler = sslHandler;
+    }
+    
+    public SSLServerIOEventDispatch(
+            final NHttpServiceHandler handler,
+            final SSLContext sslcontext,
+            final HttpParams params) {
+        this(handler, sslcontext, null, params);
+    }
+    
+    public void connected(final IOSession session) {
+
+        SSLIOSession sslSession = new SSLIOSession(
+                session, 
+                this.sslcontext,
+                this.sslHandler); 
+        
+        DefaultNHttpServerConnection conn = new DefaultNHttpServerConnection(
+                new LoggingIOSession(sslSession), 
+                new DefaultHttpRequestFactory(),
+                this.params); 
+        
+        session.setAttribute(NHTTP_CONN, conn);
+        session.setAttribute(SSL_SESSION, sslSession);
+
+        this.handler.connected(conn);
+
+        try {
+            sslSession.initialize(SSLMode.SERVER, this.params);
+        } catch (SSLException ex) {
+            this.handler.exception(conn, ex);
+            sslSession.shutdown();
+        }
+    }
+
+    public void disconnected(final IOSession session) {
+        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        this.handler.closed(conn);
+    }
+
+    public void inputReady(final IOSession session) {
+        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        SSLIOSession sslSession = (SSLIOSession) session.getAttribute(
+                SSL_SESSION);
+        try {
+            synchronized (sslSession) {
+                if (sslSession.isAppInputReady()) {
+                    conn.consumeInput(this.handler);
+                }
+                sslSession.inboundTransport();
+            }
+        } catch (IOException ex) {
+            this.handler.exception(conn, ex);
+            sslSession.shutdown();
+        }
+    }
+
+    public void outputReady(final IOSession session) {
+        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        SSLIOSession sslSession = (SSLIOSession) session.getAttribute(
+                SSL_SESSION);
+        try {
+            synchronized (sslSession) {
+                if (sslSession.isAppOutputReady()) {
+                    conn.produceOutput(this.handler);
+                }
+                sslSession.outboundTransport();
+            }
+        } catch (IOException ex) {
+            this.handler.exception(conn, ex);
+            sslSession.shutdown();
+        }
+    }
+
+    public void timeout(final IOSession session) {
+        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) 
session.getAttribute(
+                NHTTP_CONN);
+        SSLIOSession sslSession = (SSLIOSession) session.getAttribute(
+                SSL_SESSION);
+        this.handler.timeout(conn);
+        synchronized (sslSession) {
+            if (sslSession.isOutboundDone() && !sslSession.isInboundDone()) {
+                // The session failed to terminate cleanly 
+                sslSession.shutdown();
+            }
+        }
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to