You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jv...@apache.org on 2013/06/06 15:19:15 UTC

[1/2] git commit: removed IOException on connection methods

Updated Branches:
  refs/heads/trunk d5b2e2359 -> c7791be78


removed IOException on connection methods


Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/7b9e82d2
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/7b9e82d2
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/7b9e82d2

Branch: refs/heads/trunk
Commit: 7b9e82d2532cf4e58c922c04b710f4848eed5b1a
Parents: d5b2e23
Author: jvermillard <jv...@apache.org>
Authored: Thu Jun 6 15:18:06 2013 +0200
Committer: jvermillard <jv...@apache.org>
Committed: Thu Jun 6 15:18:06 2013 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/mina/api/IoClient.java    |    4 +-
 .../main/java/org/apache/mina/api/IoSession.java   |    4 +-
 .../org/apache/mina/api/MinaRuntimeException.java  |   46 +++++++++
 .../org/apache/mina/session/AbstractIoSession.java |    3 +-
 .../org/apache/mina/transport/ConnectFuture.java   |    8 ++
 .../apache/mina/transport/bio/BioUdpServer.java    |   12 +++
 .../apache/mina/transport/nio/NioTcpClient.java    |   46 ++++++++--
 .../apache/mina/transport/nio/NioUdpClient.java    |   36 ++++++--
 .../apache/mina/transport/nio/NioUdpServer.java    |    9 ++-
 .../org/apache/mina/transport/nio/SslHelper.java   |   72 +++++++--------
 .../mina/transport/udp/AbstractUdpServer.java      |    5 +-
 11 files changed, 181 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/7b9e82d2/core/src/main/java/org/apache/mina/api/IoClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/api/IoClient.java b/core/src/main/java/org/apache/mina/api/IoClient.java
index f10d7cf..6cdb1c7 100644
--- a/core/src/main/java/org/apache/mina/api/IoClient.java
+++ b/core/src/main/java/org/apache/mina/api/IoClient.java
@@ -19,7 +19,6 @@
  */
 package org.apache.mina.api;
 
-import java.io.IOException;
 import java.net.SocketAddress;
 
 /**
@@ -35,7 +34,6 @@ public interface IoClient {
      * @param remoteAddress Remote {@link SocketAddress} to connect
      * @return the {@link IoFuture} instance which is completed when the connection attempt initiated by this call
      *         succeeds or fails.
-     * @throws IOException
      */
-    IoFuture<IoSession> connect(SocketAddress remoteAddress) throws IOException;
+    IoFuture<IoSession> connect(SocketAddress remoteAddress);
 }

http://git-wip-us.apache.org/repos/asf/mina/blob/7b9e82d2/core/src/main/java/org/apache/mina/api/IoSession.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/api/IoSession.java b/core/src/main/java/org/apache/mina/api/IoSession.java
index 4b4cf64..cdc3ed9 100644
--- a/core/src/main/java/org/apache/mina/api/IoSession.java
+++ b/core/src/main/java/org/apache/mina/api/IoSession.java
@@ -24,7 +24,6 @@ import java.util.Collections;
 import java.util.Set;
 
 import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLException;
 
 import org.apache.mina.session.AttributeKey;
 import org.apache.mina.session.WriteRequest;
@@ -156,9 +155,8 @@ public interface IoSession {
      * Initializes the SSL/TLS environment for this session.
      * 
      * @param sslContext The SLLCOntext instance to use.
-     * @throws SSLException If the SSL/TLS configuration can't be initialized
      */
-    void initSecure(SSLContext sslContext) throws SSLException;
+    void initSecure(SSLContext sslContext);
 
     /**
      * Tells if the session is using SSL/TLS.

http://git-wip-us.apache.org/repos/asf/mina/blob/7b9e82d2/core/src/main/java/org/apache/mina/api/MinaRuntimeException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/api/MinaRuntimeException.java b/core/src/main/java/org/apache/mina/api/MinaRuntimeException.java
new file mode 100644
index 0000000..8fb36a1
--- /dev/null
+++ b/core/src/main/java/org/apache/mina/api/MinaRuntimeException.java
@@ -0,0 +1,46 @@
+/*
+ *  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.mina.api;
+
+/**
+ * something very wrong happened in the low level part of I/O processing.
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class MinaRuntimeException extends RuntimeException {
+
+    private static final long serialVersionUID = 1L;
+
+    public MinaRuntimeException() {
+        super();
+    }
+
+    public MinaRuntimeException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public MinaRuntimeException(String message) {
+        super(message);
+    }
+
+    public MinaRuntimeException(Throwable cause) {
+        super(cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/7b9e82d2/core/src/main/java/org/apache/mina/session/AbstractIoSession.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/session/AbstractIoSession.java b/core/src/main/java/org/apache/mina/session/AbstractIoSession.java
index ae28ef3..7d061ed 100644
--- a/core/src/main/java/org/apache/mina/session/AbstractIoSession.java
+++ b/core/src/main/java/org/apache/mina/session/AbstractIoSession.java
@@ -28,7 +28,6 @@ import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLException;
 
 import org.apache.mina.api.IdleStatus;
 import org.apache.mina.api.IoFilter;
@@ -345,7 +344,7 @@ public abstract class AbstractIoSession implements IoSession, ReadFilterChainCon
      * {@inheritDoc}
      */
     @Override
-    public void initSecure(SSLContext sslContext) throws SSLException {
+    public void initSecure(SSLContext sslContext) {
         SslHelper sslHelper = new SslHelper(this, sslContext);
         sslHelper.init();
 

http://git-wip-us.apache.org/repos/asf/mina/blob/7b9e82d2/core/src/main/java/org/apache/mina/transport/ConnectFuture.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/transport/ConnectFuture.java b/core/src/main/java/org/apache/mina/transport/ConnectFuture.java
index 2f707e5..ffb4eaf 100644
--- a/core/src/main/java/org/apache/mina/transport/ConnectFuture.java
+++ b/core/src/main/java/org/apache/mina/transport/ConnectFuture.java
@@ -37,6 +37,14 @@ public class ConnectFuture extends AbstractIoFuture<IoSession> {
     }
 
     /**
+     * Can't connect
+     */
+
+    public void cannotConnect(Exception e) {
+        setException(e);
+    }
+
+    /**
      * session connected
      */
     public void complete(IoSession session) {

http://git-wip-us.apache.org/repos/asf/mina/blob/7b9e82d2/core/src/main/java/org/apache/mina/transport/bio/BioUdpServer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/transport/bio/BioUdpServer.java b/core/src/main/java/org/apache/mina/transport/bio/BioUdpServer.java
index 6a9e371..d3d617b 100644
--- a/core/src/main/java/org/apache/mina/transport/bio/BioUdpServer.java
+++ b/core/src/main/java/org/apache/mina/transport/bio/BioUdpServer.java
@@ -29,9 +29,12 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.mina.api.IdleStatus;
+import org.apache.mina.api.IoFuture;
+import org.apache.mina.api.IoSession;
 import org.apache.mina.service.executor.IoHandlerExecutor;
 import org.apache.mina.service.idlechecker.IdleChecker;
 import org.apache.mina.service.idlechecker.IndexedIdleChecker;
+import org.apache.mina.transport.ConnectFuture;
 import org.apache.mina.transport.udp.AbstractUdpServer;
 import org.apache.mina.transport.udp.UdpSessionConfig;
 import org.slf4j.Logger;
@@ -147,6 +150,15 @@ public class BioUdpServer extends AbstractUdpServer {
 
     }
 
+    @Override
+    public IoFuture<IoSession> connect(SocketAddress remoteAddress) {
+        BioUdpSession session = new BioUdpSession(remoteAddress, BioUdpServer.this, idleChecker);
+        sessions.put(remoteAddress, session);
+        ConnectFuture cf = new ConnectFuture();
+        cf.complete(session);
+        return cf;
+    }
+
     private class Worker extends Thread {
 
         public Worker() {

http://git-wip-us.apache.org/repos/asf/mina/blob/7b9e82d2/core/src/main/java/org/apache/mina/transport/nio/NioTcpClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/transport/nio/NioTcpClient.java b/core/src/main/java/org/apache/mina/transport/nio/NioTcpClient.java
index 802bae9..1dae333 100644
--- a/core/src/main/java/org/apache/mina/transport/nio/NioTcpClient.java
+++ b/core/src/main/java/org/apache/mina/transport/nio/NioTcpClient.java
@@ -21,12 +21,14 @@ package org.apache.mina.transport.nio;
 
 import java.io.IOException;
 import java.net.SocketAddress;
+import java.net.SocketException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.SocketChannel;
 
 import org.apache.mina.api.IdleStatus;
 import org.apache.mina.api.IoFuture;
 import org.apache.mina.api.IoSession;
+import org.apache.mina.api.MinaRuntimeException;
 import org.apache.mina.service.executor.IoHandlerExecutor;
 import org.apache.mina.service.executor.OrderedHandlerExecutor;
 import org.apache.mina.service.idlechecker.IdleChecker;
@@ -105,15 +107,28 @@ public class NioTcpClient extends AbstractTcpClient {
      * {@inheritDoc}
      */
     @Override
-    public IoFuture<IoSession> connect(SocketAddress remoteAddress) throws IOException {
+    public IoFuture<IoSession> connect(SocketAddress remoteAddress) {
         Assert.assertNotNull(remoteAddress, "remoteAddress");
 
-        SocketChannel clientSocket = SocketChannel.open();
+        SocketChannel clientSocket;
+        try {
+            clientSocket = SocketChannel.open();
+        } catch (IOException e) {
+            throw new MinaRuntimeException("can't create a new socket, out of file descriptors ?", e);
+        }
 
-        clientSocket.socket().setSoTimeout(getConnectTimeoutMillis());
+        try {
+            clientSocket.socket().setSoTimeout(getConnectTimeoutMillis());
+        } catch (SocketException e) {
+            throw new MinaRuntimeException("can't set socket timeout", e);
+        }
 
         // non blocking
-        clientSocket.configureBlocking(false);
+        try {
+            clientSocket.configureBlocking(false);
+        } catch (IOException e) {
+            throw new MinaRuntimeException("can't configure socket as non-blocking", e);
+        }
 
         // apply idle configuration
         // Has to be final, as it's used in a inner class...
@@ -155,7 +170,12 @@ public class NioTcpClient extends AbstractTcpClient {
         if (receiveBufferSize != null) {
             session.getConfig().setReadBufferSize(receiveBufferSize);
         } else {
-            int rcvBufferSize = clientSocket.socket().getReceiveBufferSize();
+            int rcvBufferSize;
+            try {
+                rcvBufferSize = clientSocket.socket().getReceiveBufferSize();
+            } catch (SocketException e) {
+                throw new MinaRuntimeException("can't configure socket receive buffer size", e);
+            }
             session.getConfig().setReadBufferSize(rcvBufferSize);
         }
 
@@ -164,7 +184,12 @@ public class NioTcpClient extends AbstractTcpClient {
         if (sendBufferSize != null) {
             session.getConfig().setSendBufferSize(sendBufferSize);
         } else {
-            int sndBufferSize = clientSocket.socket().getSendBufferSize();
+            int sndBufferSize;
+            try {
+                sndBufferSize = clientSocket.socket().getSendBufferSize();
+            } catch (SocketException e) {
+                throw new MinaRuntimeException("can't configure socket send buffe size", e);
+            }
             session.getConfig().setSendBufferSize(sndBufferSize);
         }
 
@@ -187,7 +212,14 @@ public class NioTcpClient extends AbstractTcpClient {
 
         // connect to a running server. We get an immediate result if
         // the socket is blocking, and either true or false if it's non blocking
-        boolean connected = clientSocket.connect(remoteAddress);
+        boolean connected;
+        try {
+            connected = clientSocket.connect(remoteAddress);
+        } catch (IOException e) {
+            ConnectFuture future = new ConnectFuture();
+            future.cannotConnect(e);
+            return future;
+        }
 
         ConnectFuture connectFuture = new ConnectFuture();
         session.setConnectFuture(connectFuture);

http://git-wip-us.apache.org/repos/asf/mina/blob/7b9e82d2/core/src/main/java/org/apache/mina/transport/nio/NioUdpClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/transport/nio/NioUdpClient.java b/core/src/main/java/org/apache/mina/transport/nio/NioUdpClient.java
index 1d51ccf..02c6d51 100644
--- a/core/src/main/java/org/apache/mina/transport/nio/NioUdpClient.java
+++ b/core/src/main/java/org/apache/mina/transport/nio/NioUdpClient.java
@@ -21,11 +21,13 @@ package org.apache.mina.transport.nio;
 
 import java.io.IOException;
 import java.net.SocketAddress;
+import java.net.SocketException;
 import java.nio.channels.DatagramChannel;
 
 import org.apache.mina.api.IdleStatus;
 import org.apache.mina.api.IoFuture;
 import org.apache.mina.api.IoSession;
+import org.apache.mina.api.MinaRuntimeException;
 import org.apache.mina.service.executor.IoHandlerExecutor;
 import org.apache.mina.service.idlechecker.IndexedIdleChecker;
 import org.apache.mina.transport.ConnectFuture;
@@ -66,11 +68,20 @@ public class NioUdpClient extends AbstractUdpClient {
      * {@inheritDoc}
      */
     @Override
-    public IoFuture<IoSession> connect(SocketAddress remoteAddress) throws IOException {
+    public IoFuture<IoSession> connect(SocketAddress remoteAddress) {
         Assert.assertNotNull(remoteAddress, "remoteAddress");
 
-        DatagramChannel ch = DatagramChannel.open();
-        ch.configureBlocking(false);
+        DatagramChannel ch;
+        try {
+            ch = DatagramChannel.open();
+        } catch (IOException e) {
+            throw new MinaRuntimeException("can't create a new socket, out of file descriptors ?", e);
+        }
+        try {
+            ch.configureBlocking(false);
+        } catch (IOException e) {
+            throw new MinaRuntimeException("can't configure socket as non-blocking", e);
+        }
 
         UdpSessionConfig config = getSessionConfig();
 
@@ -102,8 +113,14 @@ public class NioUdpClient extends AbstractUdpClient {
         if (readBufferSize != null) {
             session.getConfig().setReadBufferSize(readBufferSize);
         } else {
-            int rcvBufferSize = ch.socket().getReceiveBufferSize();
-            session.getConfig().setReadBufferSize(rcvBufferSize);
+            int rcvBufferSize;
+            try {
+                rcvBufferSize = ch.socket().getReceiveBufferSize();
+                session.getConfig().setReadBufferSize(rcvBufferSize);
+
+            } catch (SocketException e) {
+                throw new MinaRuntimeException("can't configure socket receive buffer size", e);
+            }
         }
 
         Integer sendBufferSize = config.getSendBufferSize();
@@ -111,8 +128,13 @@ public class NioUdpClient extends AbstractUdpClient {
         if (sendBufferSize != null) {
             session.getConfig().setSendBufferSize(sendBufferSize);
         } else {
-            int sndBufferSize = ch.socket().getSendBufferSize();
-            session.getConfig().setSendBufferSize(sndBufferSize);
+            int sndBufferSize;
+            try {
+                sndBufferSize = ch.socket().getSendBufferSize();
+                session.getConfig().setSendBufferSize(sndBufferSize);
+            } catch (SocketException e) {
+                throw new MinaRuntimeException("can't configure socket send buffe size", e);
+            }
         }
 
         Integer trafficClass = config.getTrafficClass();

http://git-wip-us.apache.org/repos/asf/mina/blob/7b9e82d2/core/src/main/java/org/apache/mina/transport/nio/NioUdpServer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/transport/nio/NioUdpServer.java b/core/src/main/java/org/apache/mina/transport/nio/NioUdpServer.java
index 1a83f12..9d3475c 100644
--- a/core/src/main/java/org/apache/mina/transport/nio/NioUdpServer.java
+++ b/core/src/main/java/org/apache/mina/transport/nio/NioUdpServer.java
@@ -29,6 +29,8 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.mina.api.IdleStatus;
+import org.apache.mina.api.IoFuture;
+import org.apache.mina.api.IoSession;
 import org.apache.mina.service.executor.IoHandlerExecutor;
 import org.apache.mina.service.executor.OrderedHandlerExecutor;
 import org.apache.mina.service.idlechecker.IdleChecker;
@@ -168,6 +170,11 @@ public class NioUdpServer extends AbstractUdpServer implements SelectorListener
         this.fireServiceActivated();
     }
 
+    @Override
+    public IoFuture<IoSession> connect(SocketAddress remoteAddress) {
+        throw new IllegalStateException("not supported");
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -208,7 +215,7 @@ public class NioUdpServer extends AbstractUdpServer implements SelectorListener
             final boolean write) {
         // Process the reads first
         try {
-            //System.err.println("remaining : " + readBuffer.remaining());
+            // System.err.println("remaining : " + readBuffer.remaining());
             final SocketAddress source = datagramChannel.receive(readBuffer);
             NioUdpSession session = null;
 

http://git-wip-us.apache.org/repos/asf/mina/blob/7b9e82d2/core/src/main/java/org/apache/mina/transport/nio/SslHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/transport/nio/SslHelper.java b/core/src/main/java/org/apache/mina/transport/nio/SslHelper.java
index c2996d2..aeb19f5 100644
--- a/core/src/main/java/org/apache/mina/transport/nio/SslHelper.java
+++ b/core/src/main/java/org/apache/mina/transport/nio/SslHelper.java
@@ -34,7 +34,6 @@ import javax.net.ssl.SSLSession;
 
 import org.apache.mina.api.IoClient;
 import org.apache.mina.api.IoSession;
-import org.apache.mina.api.IoSession.SessionState;
 import org.apache.mina.session.AbstractIoSession;
 import org.apache.mina.session.AttributeKey;
 import org.apache.mina.session.DefaultWriteRequest;
@@ -82,7 +81,7 @@ public class SslHelper {
 
     /** An empty buffer used during the handshake phase */
     private static final ByteBuffer HANDSHAKE_BUFFER = ByteBuffer.allocate(1024);
-    
+
     private ByteBuffer previous = null;
 
     /**
@@ -112,13 +111,12 @@ public class SslHelper {
     boolean isHanshaking() {
         return sslEngine.getHandshakeStatus() != HandshakeStatus.NOT_HANDSHAKING;
     }
-    
+
     /**
      * Initialize the SSL handshake.
      * 
-     * @throws SSLException If the underlying SSLEngine handshake initialization failed
      */
-    public void init() throws SSLException {
+    public void init() {
         if (sslEngine != null) {
             // We already have a SSL engine created, no need to create a new one
             return;
@@ -160,8 +158,7 @@ public class SslHelper {
     }
 
     /**
-     * Duplicate a byte buffer for storing it into this context for future
-     * use.
+     * Duplicate a byte buffer for storing it into this context for future use.
      * 
      * @param buffer the buffer to duplicate
      * @return the newly allocated buffer
@@ -172,10 +169,9 @@ public class SslHelper {
         newBuffer.flip();
         return newBuffer;
     }
-    
+
     /**
-     * Accumulate the given buffer into the current context. Allocation is performed only
-     * if needed.
+     * Accumulate the given buffer into the current context. Allocation is performed only if needed.
      * 
      * @param buffer the buffer to accumulate
      * @return the accumulated buffer
@@ -188,7 +184,7 @@ public class SslHelper {
             previous.put(buffer);
             previous.position(oldPosition);
         } else {
-            ByteBuffer newPrevious = ByteBuffer.allocateDirect((previous.remaining() + buffer.remaining() ) * 2);
+            ByteBuffer newPrevious = ByteBuffer.allocateDirect((previous.remaining() + buffer.remaining()) * 2);
             newPrevious.put(previous);
             newPrevious.put(buffer);
             newPrevious.flip();
@@ -196,7 +192,7 @@ public class SslHelper {
         }
         return previous;
     }
-    
+
     /**
      * Process a read ByteBuffer over a secured connection, or during the SSL/TLS Handshake.
      * 
@@ -206,47 +202,45 @@ public class SslHelper {
      */
     public void processRead(AbstractIoSession session, ByteBuffer readBuffer) throws SSLException {
         ByteBuffer tempBuffer;
-        
+
         if (previous != null) {
             tempBuffer = accumulate(readBuffer);
         } else {
             tempBuffer = readBuffer;
         }
-        
-        
+
         boolean done = false;
         SSLEngineResult result;
         ByteBuffer appBuffer = ByteBuffer.allocateDirect(sslEngine.getSession().getApplicationBufferSize());
-        
+
         HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus();
         while (!done) {
             switch (handshakeStatus) {
             case NEED_UNWRAP:
             case NOT_HANDSHAKING:
             case FINISHED:
-              result = sslEngine.unwrap(tempBuffer, appBuffer);
-              handshakeStatus = result.getHandshakeStatus();
-
-              switch (result.getStatus()) {
-              case BUFFER_UNDERFLOW:
-                  /* we need more data */
-                  done = true;
-                  break;
-              case BUFFER_OVERFLOW:
-                  /* resize output buffer */
-                  appBuffer = ByteBuffer.allocateDirect(appBuffer.capacity() * 2);
-                  break;
-              case OK:
-                  if ((handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) &&
-                      (result.bytesProduced() > 0)) {
-                      appBuffer.flip();
-                      session.processMessageReceived(appBuffer);
-                  }
-              }
-              break;
+                result = sslEngine.unwrap(tempBuffer, appBuffer);
+                handshakeStatus = result.getHandshakeStatus();
+
+                switch (result.getStatus()) {
+                case BUFFER_UNDERFLOW:
+                    /* we need more data */
+                    done = true;
+                    break;
+                case BUFFER_OVERFLOW:
+                    /* resize output buffer */
+                    appBuffer = ByteBuffer.allocateDirect(appBuffer.capacity() * 2);
+                    break;
+                case OK:
+                    if ((handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) && (result.bytesProduced() > 0)) {
+                        appBuffer.flip();
+                        session.processMessageReceived(appBuffer);
+                    }
+                }
+                break;
             case NEED_TASK:
                 Runnable task;
-                
+
                 while ((task = sslEngine.getDelegatedTask()) != null) {
                     task.run();
                 }
@@ -256,7 +250,7 @@ public class SslHelper {
                 result = sslEngine.wrap(EMPTY_BUFFER, appBuffer);
                 handshakeStatus = result.getHandshakeStatus();
                 switch (result.getStatus()) {
-                case  BUFFER_OVERFLOW:
+                case BUFFER_OVERFLOW:
                     appBuffer = ByteBuffer.allocateDirect(appBuffer.capacity() * 2);
                     break;
                 case BUFFER_UNDERFLOW:
@@ -278,7 +272,7 @@ public class SslHelper {
             previous = null;
         }
         readBuffer.clear();
-     }
+    }
 
     /**
      * Process the application data encryption for a session.

http://git-wip-us.apache.org/repos/asf/mina/blob/7b9e82d2/core/src/main/java/org/apache/mina/transport/udp/AbstractUdpServer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/transport/udp/AbstractUdpServer.java b/core/src/main/java/org/apache/mina/transport/udp/AbstractUdpServer.java
index 4bc62e7..08ca9be 100644
--- a/core/src/main/java/org/apache/mina/transport/udp/AbstractUdpServer.java
+++ b/core/src/main/java/org/apache/mina/transport/udp/AbstractUdpServer.java
@@ -21,16 +21,17 @@ package org.apache.mina.transport.udp;
 
 import javax.net.ssl.SSLException;
 
+import org.apache.mina.api.IoClient;
 import org.apache.mina.api.IoSession;
 import org.apache.mina.service.executor.IoHandlerExecutor;
 import org.apache.mina.service.server.AbstractIoServer;
 
 /**
- * TODO
+ * Base implementation for all the UDP servers.
  * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public abstract class AbstractUdpServer extends AbstractIoServer {
+public abstract class AbstractUdpServer extends AbstractIoServer implements IoClient {
     /**
      * Create an new AbsractUdpServer instance
      * 


[2/2] git commit: guava is not used anymore

Posted by jv...@apache.org.
guava is not used anymore


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

Branch: refs/heads/trunk
Commit: c7791be78958e3a48d6c99464070f0c70a3d99a3
Parents: 7b9e82d
Author: jvermillard <jv...@apache.org>
Authored: Thu Jun 6 15:18:32 2013 +0200
Committer: jvermillard <jv...@apache.org>
Committed: Thu Jun 6 15:18:32 2013 +0200

----------------------------------------------------------------------
 pom.xml |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/c7791be7/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1dc8544..157711a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,7 +85,6 @@
 
   <properties>
     <!-- Dependencies versions ========================================== -->
-    <version.guava>14.0.1</version.guava>
     <version.junit>4.11</version.junit>
     <version.log4j>2.0-beta2</version.log4j>
     <version.mockito-core>1.9.5</version.mockito-core>
@@ -137,12 +136,6 @@
           <scope>test</scope>
       </dependency>
 
-      <dependency>
-        <groupId>com.google.guava</groupId>
-        <artifactId>guava</artifactId>
-        <version>${version.guava}</version>
-      </dependency>
-
       <!--dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-log4j12</artifactId>