directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r371243 - in /directory/sandbox/trustin/mina-spi/core/src: main/java/org/apache/mina/common/ main/java/org/apache/mina/common/support/ main/java/org/apache/mina/common/support/discovery/jdk/ main/java/org/apache/mina/common/support/discover...
Date Sun, 22 Jan 2006 08:56:27 GMT
Author: trustin
Date: Sun Jan 22 00:56:06 2006
New Revision: 371243

URL: http://svn.apache.org/viewcvs?rev=371243&view=rev
Log:
* Removed unnecessary TODOs and FIXMEs
* Now all acceptor and connector settings are configurable with the ? query in IoAddress.

Added:
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/Constants.java   (with props)
Removed:
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/UnmodifiableProperties.java
Modified:
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/IoAddress.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/discovery/jdk/JDKHooks.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/discovery/tools/DiscoverSingleton.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/NotImplementedException.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/math/JVMRandom.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DateUtils.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DurationFormatUtils.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSessionManager.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
    directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/common/FutureTest.java
    directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java
    directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
    directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java
    directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java
    directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java
    directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/handler/chain/ChainedIoHandlerTest.java
    directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/AbstractBindTest.java
    directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramBindTest.java
    directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/socket/nio/SocketBindTest.java
    directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/vmpipe/VmPipeBindTest.java

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/IoAddress.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/IoAddress.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/IoAddress.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/IoAddress.java Sun Jan 22 00:56:06 2006
@@ -18,12 +18,21 @@
  */
 package org.apache.mina.common;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
 import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.InvalidPropertiesFormatException;
+import java.util.Map;
 import java.util.Properties;
-
-import org.apache.mina.common.support.UnmodifiableProperties;
+import java.util.Set;
 
 /**
  * Represents the address of the location where I/O occurs.
@@ -61,11 +70,11 @@
         }
         if( properties == null )
         {
-            properties = new UnmodifiableProperties();
+            properties = new IoAddressProperties();
         }
-        else if( !( properties instanceof UnmodifiableProperties ) )
+        else if( !( properties instanceof IoAddressProperties ) )
         {
-            properties = new UnmodifiableProperties( ( Properties ) properties.clone() );
+            properties = new IoAddressProperties( ( Properties ) properties.clone() );
         }
         
         providerType = providerType.trim().toLowerCase();
@@ -109,7 +118,7 @@
         if( questionPos < startPos )
         {
             address = uri.substring( startPos ).trim();
-            properties = new UnmodifiableProperties();
+            properties = new IoAddressProperties();
         }
         else
         {
@@ -157,7 +166,7 @@
             throw ( InternalError ) new InternalError().initCause( e );
         }
         
-        return new UnmodifiableProperties( ret );
+        return new IoAddressProperties( ret );
     }
     
     public String getProviderType()
@@ -217,5 +226,189 @@
     {
         return new IoAddress(
                 providerType, transportType, address, properties );
+    }
+
+    private static class IoAddressProperties extends Properties
+    {
+        private static final long serialVersionUID = 4951867421321628797L;
+        
+        private final Properties props;
+
+        public IoAddressProperties()
+        {
+            this.props = new Properties();
+        }
+
+        public IoAddressProperties( Properties props )
+        {
+            super();
+            this.props = props;
+        }
+
+        public Object setProperty( String key, String value )
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        public void clear()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        public Set entrySet()
+        {
+            return Collections.unmodifiableSet( props.entrySet() );
+        }
+
+        public Set keySet()
+        {
+            return Collections.unmodifiableSet( props.keySet() );
+        }
+
+        public Object put( Object arg0, Object arg1 )
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        public void putAll( Map arg0 )
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        public Object remove( Object key )
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        public Collection values()
+        {
+            return Collections.unmodifiableCollection( props.values() );
+        }
+        
+        public Object clone()
+        {
+            return new IoAddressProperties( props );
+        }
+
+        public String getProperty( String key, String defaultValue )
+        {
+            return props.getProperty( key.toLowerCase(), defaultValue );
+        }
+
+        public String getProperty( String key )
+        {
+            return props.getProperty( key.toLowerCase() );
+        }
+
+        public void list( PrintStream out )
+        {
+            props.list( out );
+        }
+
+        public void list( PrintWriter out )
+        {
+            props.list( out );
+        }
+
+        public void load( InputStream inStream ) throws IOException
+        {
+            props.load( inStream );
+        }
+
+        public void loadFromXML( InputStream in ) throws IOException, InvalidPropertiesFormatException
+        {
+            props.loadFromXML( in );
+        }
+
+        public Enumeration propertyNames()
+        {
+            return props.propertyNames();
+        }
+
+        /**
+         * @deprecated
+         */
+        public void save( OutputStream out, String comments )
+        {
+            props.save( out, comments );
+        }
+
+        public void store( OutputStream out, String comments ) throws IOException
+        {
+            props.store( out, comments );
+        }
+
+        public void storeToXML( OutputStream os, String comment, String encoding ) throws IOException
+        {
+            props.storeToXML( os, comment, encoding );
+        }
+
+        public void storeToXML( OutputStream os, String comment ) throws IOException
+        {
+            props.storeToXML( os, comment );
+        }
+
+        public boolean contains( Object value )
+        {
+            return props.contains( value );
+        }
+
+        public boolean containsKey( Object key )
+        {
+            if( key instanceof String )
+            {
+                key = ( ( String ) key ).toLowerCase();
+            }
+            return props.containsKey( key );
+        }
+
+        public boolean containsValue( Object value )
+        {
+            return props.containsValue( value );
+        }
+
+        public Enumeration elements()
+        {
+            return props.elements();
+        }
+
+        public boolean equals( Object o )
+        {
+            return props.equals( o );
+        }
+
+        public Object get( Object key )
+        {
+            if( key instanceof String )
+            {
+                key = ( ( String ) key ).toLowerCase();
+            }
+            return props.get( key );
+        }
+
+        public int hashCode()
+        {
+            return props.hashCode();
+        }
+
+        public boolean isEmpty()
+        {
+            return props.isEmpty();
+        }
+
+        public Enumeration keys()
+        {
+            return props.keys();
+        }
+
+        public int size()
+        {
+            return props.size();
+        }
+
+        public String toString()
+        {
+            return props.toString();
+        }
     }
 }

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/discovery/jdk/JDKHooks.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/discovery/jdk/JDKHooks.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/discovery/jdk/JDKHooks.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/discovery/jdk/JDKHooks.java Sun Jan 22 00:56:06 2006
@@ -79,8 +79,6 @@
     
     /**
      * Return singleton object representing JVM hooks/tools.
-     * 
-     * TODO: add logic to detect JDK level.
      */
     public static final JDKHooks getJDKHooks() {
         return jdkHooks;

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/discovery/tools/DiscoverSingleton.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/discovery/tools/DiscoverSingleton.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/discovery/tools/DiscoverSingleton.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/discovery/tools/DiscoverSingleton.java Sun Jan 22 00:56:06 2006
@@ -493,8 +493,6 @@
      * Implements first two levels of the cache (loader & groupContext).
      * Allows null keys, important as default groupContext is null.
      */
-    // FIXME: Why is this here? All the methods used are static.
-    //private static final EnvironmentCache root_cache = new EnvironmentCache();
 
     /**
      * Get service keyed by spi & classLoader.

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/NotImplementedException.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/NotImplementedException.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/NotImplementedException.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/NotImplementedException.java Sun Jan 22 00:56:06 2006
@@ -28,7 +28,7 @@
  * 
  * <p><code>NotImplementedException</code> represents the case where the
  * author has yet to implement the logic at this point in the program.
- * This can act as an exception based TODO tag.
+ * This can act as an exception based todo tag.
  * Because this logic might be within a catch block, this exception
  * suports exception chaining.</p>
  * 
@@ -38,7 +38,7 @@
  *     // do something that throws an Exception
  *   } catch (Exception ex) {
  *     // don't know what to do here yet
- *     throw new NotImplementedException("TODO", ex);
+ *     throw new NotImplementedException("todo", ex);
  *   }
  * }
  * </pre>

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/math/JVMRandom.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/math/JVMRandom.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/math/JVMRandom.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/math/JVMRandom.java Sun Jan 22 00:56:06 2006
@@ -96,7 +96,6 @@
                 "Upper bound for nextInt must be positive"
             );
         }
-        // TODO: check this cannot return 'n'
         return (int)(Math.random() * n);
     }
     /**
@@ -125,7 +124,6 @@
                 "Upper bound for nextInt must be positive"
             );
         }
-        // TODO: check this cannot return 'n'
         return (long)(Math.random() * n);
      }
 

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DateUtils.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DateUtils.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DateUtils.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DateUtils.java Sun Jan 22 00:56:06 2006
@@ -770,7 +770,6 @@
     
     //------------------------------------------------------------------------- 
     // Deprecated int constants
-    // TODO: Remove in 3.0
     
     /**
      * Number of milliseconds in a standard second.

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DurationFormatUtils.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DurationFormatUtils.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DurationFormatUtils.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/lang/time/DurationFormatUtils.java Sun Jan 22 00:56:06 2006
@@ -325,7 +325,6 @@
                 months += 12 * years;
                 years = 0;
             } else {
-                // TODO: this is a bit weak, needs work to know about leap years
                 days += 365 * years;
                 years = 0;
             }
@@ -477,7 +476,6 @@
             }
             Object value = null;
             switch(ch) {
-                // TODO: Need to handle escaping of '
                 case '\'' : 
                   if(inLiteral) {
                       buffer = null;

Added: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/Constants.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/Constants.java?rev=371243&view=auto
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/Constants.java (added)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/Constants.java Sun Jan 22 00:56:06 2006
@@ -0,0 +1,45 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 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.mina.transport.socket.nio;
+
+/**
+ * Constants used by this package.
+ *
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+class Constants
+{
+    public static final String REUSE_ADDRESS = "reuseAddress";
+    public static final String BROADCAST = "broadcast";
+    public static final String RECEIVE_BUFFER_SIZE = "receiveBufferSize";
+    public static final String SEND_BUFFER_SIZE = "sendBufferSize";
+    public static final String TRAFFIC_CLASS = "trafficClass";
+    public static final String BACKLOG = "backlog";
+    public static final String OOB_INLINE = "OOBInline";
+    public static final String KEEP_ALIVE = "keepAlive";
+    public static final String SO_LINGER = "soLinger";
+    public static final String TCP_NO_DELAY = "TCPNoDelay";
+    public static final String CONNECT_TIMEOUT = "connectTimeout";
+    public static final String DISCONNECT_ON_UNBIND = "disconnectOnUnbind";
+    
+    private Constants()
+    {
+    }
+}

Propchange: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/Constants.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java Sun Jan 22 00:56:06 2006
@@ -46,17 +46,12 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-class DatagramAcceptor implements IoAcceptor, DatagramSessionManager
+class DatagramAcceptor extends DatagramSessionManager implements IoAcceptor
 {
     private static volatile int nextId = 0;
 
     private final int id = nextId ++ ;
     private Selector selector;
-    private boolean broadcast;
-    private boolean reuseAddress;
-    private int receiveBufferSize = -1;
-    private int sendBufferSize = -1;
-    private int trafficClass = -1;
     private final Map channels = new HashMap();
     private final Queue registerQueue = new Queue();
     private final Queue cancelQueue = new Queue();
@@ -189,57 +184,6 @@
         throw new UnsupportedOperationException();
     }
 
-    public boolean getBroadcast()
-    {
-        return broadcast;
-    }
-    
-    public void setBroadcast( boolean broadcast )
-    {
-        this.broadcast = broadcast;
-    }
-    
-    public boolean getReuseAddress()
-    {
-        return reuseAddress;
-    }
-    
-    public void setReuseAddress( boolean reuseAddress )
-    {
-        this.reuseAddress = reuseAddress;
-    }
-
-
-    public int getReceiveBufferSize()
-    {
-        return receiveBufferSize;
-    }
-
-    public void setReceiveBufferSize( int receiveBufferSize )
-    {
-        this.receiveBufferSize = receiveBufferSize;
-    }
-
-    public int getSendBufferSize()
-    {
-        return sendBufferSize;
-    }
-
-    public void setSendBufferSize( int sendBufferSize )
-    {
-        this.sendBufferSize = sendBufferSize;
-    }
-
-    public int getTrafficClass()
-    {
-        return trafficClass;
-    }
-
-    public void setTrafficClass( int trafficClass )
-    {
-        this.trafficClass = trafficClass;
-    }
-
     private synchronized void startupWorker() throws IOException
     {
         if( worker == null )
@@ -525,20 +469,7 @@
             try
             {
                 ch = DatagramChannel.open();
-                ch.socket().setReuseAddress( reuseAddress );
-                ch.socket().setBroadcast( broadcast );
-                if( receiveBufferSize > 0 )
-                {
-                    ch.socket().setReceiveBufferSize( receiveBufferSize );
-                }
-                if( sendBufferSize > 0 )
-                {
-                    ch.socket().setSendBufferSize( sendBufferSize );
-                }
-                if( trafficClass > 0 )
-                {
-                    ch.socket().setTrafficClass( trafficClass );
-                }
+                configureSocket( ch, req.address.getProperties() );
                 ch.configureBlocking( false );
                 ch.socket().bind( SocketAddresses.parse( req.address ) );
                 ch.register( selector, SelectionKey.OP_READ, req );

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java Sun Jan 22 00:56:06 2006
@@ -41,17 +41,12 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-class DatagramConnector implements DatagramSessionManager, IoConnector
+class DatagramConnector extends DatagramSessionManager implements IoConnector
 {
     private static volatile int nextId = 0;
 
     private final int id = nextId ++ ;
     private Selector selector;
-    private boolean broadcast;
-    private boolean reuseAddress;
-    private int receiveBufferSize = -1;
-    private int sendBufferSize = -1;
-    private int trafficClass = -1;
     private final Queue registerQueue = new Queue();
     private final Queue cancelQueue = new Queue();
     private final Queue flushingSessions = new Queue();
@@ -73,20 +68,7 @@
         try
         {
             ch = DatagramChannel.open();
-            ch.socket().setReuseAddress( reuseAddress );
-            ch.socket().setBroadcast( broadcast );
-            if( receiveBufferSize > 0 )
-            {
-                ch.socket().setReceiveBufferSize( receiveBufferSize );
-            }
-            if( sendBufferSize > 0 )
-            {
-                ch.socket().setSendBufferSize( sendBufferSize );
-            }
-            if( trafficClass > 0 )
-            {
-                ch.socket().setTrafficClass( trafficClass );
-            }
+            configureSocket( ch, address.getProperties() );
             if( localAddress != null )
             {
                 ch.socket().bind( SocketAddresses.parse( localAddress ) );
@@ -145,56 +127,6 @@
 
         selector.wakeup();
         return request;
-    }
-    
-    public boolean getBroadcast()
-    {
-        return broadcast;
-    }
-    
-    public void setBroadcast( boolean broadcast )
-    {
-        this.broadcast = broadcast;
-    }
-    
-    public boolean getReuseAddress()
-    {
-        return reuseAddress;
-    }
-    
-    public void setReuseAddress( boolean reuseAddress )
-    {
-        this.reuseAddress = reuseAddress;
-    }
-
-    public int getReceiveBufferSize()
-    {
-        return receiveBufferSize;
-    }
-
-    public void setReceiveBufferSize( int receiveBufferSize )
-    {
-        this.receiveBufferSize = receiveBufferSize;
-    }
-
-    public int getSendBufferSize()
-    {
-        return sendBufferSize;
-    }
-
-    public void setSendBufferSize( int sendBufferSize )
-    {
-        this.sendBufferSize = sendBufferSize;
-    }
-
-    public int getTrafficClass()
-    {
-        return trafficClass;
-    }
-
-    public void setTrafficClass( int trafficClass )
-    {
-        this.trafficClass = trafficClass;
     }
 
     private synchronized void startupWorker() throws IOException

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSessionManager.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSessionManager.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSessionManager.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSessionManager.java Sun Jan 22 00:56:06 2006
@@ -18,6 +18,10 @@
  */
 package org.apache.mina.transport.socket.nio;
 
+import java.net.SocketException;
+import java.nio.channels.DatagramChannel;
+import java.util.Properties;
+
 
 /**
  * A base interface for {@link DatagramAcceptor} and {@link DatagramConnector}.
@@ -25,23 +29,45 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-interface DatagramSessionManager
+abstract class DatagramSessionManager
 {
+    protected static void configureSocket( DatagramChannel ch, Properties props ) throws SocketException
+    {
+        ch.socket().setReuseAddress(
+                "true".equalsIgnoreCase( props.getProperty( Constants.REUSE_ADDRESS ) ) );
+        ch.socket().setBroadcast(
+                "true".equalsIgnoreCase( props.getProperty( Constants.BROADCAST ) ) );
+        if( props.containsKey( Constants.RECEIVE_BUFFER_SIZE ) )
+        {
+            ch.socket().setReceiveBufferSize(
+                    Integer.parseInt( props.getProperty( Constants.RECEIVE_BUFFER_SIZE ) ) );
+        }
+        if( props.containsKey( Constants.SEND_BUFFER_SIZE ) )
+        {
+            ch.socket().setSendBufferSize(
+                    Integer.parseInt( props.getProperty( Constants.SEND_BUFFER_SIZE ) ) );
+        }
+        if( props.containsKey( Constants.TRAFFIC_CLASS ) )
+        {
+            ch.socket().setTrafficClass(
+                    Integer.parseInt( props.getProperty( Constants.TRAFFIC_CLASS ) ) );
+        }
+    }
     /**
      * Requests this processor to flush the write buffer of the specified
      * session.  This method is invoked by MINA internally.
      */
-    void flushSession( DatagramSession session );
+    abstract void flushSession( DatagramSession session );
 
     /**
      * Requests this processor to close the specified session.
      * This method is invoked by MINA internally.
      */
-    void closeSession( DatagramSession session );
+    abstract void closeSession( DatagramSession session );
     
     /**
      * Requests this processor to update the traffic mask for the specified
      * session. This method is invoked by MINA internally.
      */
-    void updateTrafficMask( DatagramSession session );    
+    abstract void updateTrafficMask( DatagramSession session );    
 }

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java Sun Jan 22 00:56:06 2006
@@ -31,11 +31,13 @@
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 
 import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.common.IoAddress;
 import org.apache.mina.common.IoFilterChainBuilder;
+import org.apache.mina.common.IoFuture;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoServiceProvider.IoAcceptor;
@@ -54,9 +56,6 @@
 
     private final int id = nextId ++ ;
     private final String threadName = "SocketAcceptor-" + id;
-    private boolean reuseAddress = false;
-    private int backlog = 50;
-    private int receiveBufferSize = -1;
     private Selector selector;
     private final Map channels = new HashMap();
     private final Hashtable sessions = new Hashtable();
@@ -69,7 +68,7 @@
     /**
      * Creates a new instance.
      */
-    public SocketAcceptor()
+    SocketAcceptor()
     {
     }
 
@@ -192,10 +191,11 @@
             throw request.exception;
         }
         
-        
         // Disconnect all clients
-        /* FIXME Enable this when configuration interface is ready
-        if( isDisconnectClientsOnUnbind() && managedSessions != null )
+        if( !"false".equalsIgnoreCase(
+                request.registrationRequest.address.getProperties().getProperty(
+                        Constants.DISCONNECT_ON_UNBIND ) ) &&
+            managedSessions != null )
         {
             IoSession[] tempSessions = ( IoSession[] ) 
                                   managedSessions.toArray( new IoSession[ 0 ] );
@@ -236,9 +236,7 @@
             {
                 // Ignored
             }
-            
         }
-        */       
     }
     
     public IoSession newSession( IoAddress remoteAddress, IoAddress localAddress )
@@ -388,6 +386,7 @@
             }
 
             ServerSocketChannel ssc = null;
+            Properties props = req.address.getProperties();
 
             try
             {
@@ -395,14 +394,25 @@
                 ssc.configureBlocking( false );
                 
                 // Configure the server socket,
-                ssc.socket().setReuseAddress( isReuseAddress() );
-                if( getReceiveBufferSize() > 0 )
+                ssc.socket().setReuseAddress(
+                        "true".equalsIgnoreCase( props.getProperty( Constants.REUSE_ADDRESS ) ) );
+                if( props.containsKey( Constants.RECEIVE_BUFFER_SIZE ) )
                 {
-                    ssc.socket().setReceiveBufferSize( getReceiveBufferSize() );
+                    ssc.socket().setReceiveBufferSize(
+                            Integer.parseInt( props.getProperty( Constants.RECEIVE_BUFFER_SIZE ) ) );
                 }
                 
                 // and bind.
-                ssc.socket().bind( SocketAddresses.parse( req.address ), getBacklog() );
+                if( props.containsKey( Constants.BACKLOG ) )
+                {
+                    ssc.socket().bind(
+                            SocketAddresses.parse( req.address ),
+                            Integer.parseInt( props.getProperty( Constants.BACKLOG ) ) );
+                }
+                else
+                {
+                    ssc.socket().bind( SocketAddresses.parse( req.address ) );
+                }
                 ssc.register( selector, SelectionKey.OP_ACCEPT, req );
 
                 channels.put( req.address, ssc );
@@ -471,7 +481,7 @@
                 else
                 {
                     SelectionKey key = ssc.keyFor( selector );
-
+                    request.registrationRequest = ( RegistrationRequest ) key.attachment();
                     key.cancel();
 
                     selector.wakeup(); // wake up again to trigger thread death
@@ -495,43 +505,6 @@
         }
     }
 
-    public int getReceiveBufferSize()
-    {
-        return receiveBufferSize;
-    }
-
-    /**
-     * @param receiveBufferSize <tt>-1</tt> to use the default value.
-     */
-    public void setReceiveBufferSize( int receiveBufferSize )
-    {
-        this.receiveBufferSize = receiveBufferSize;
-    }
-
-    public boolean isReuseAddress()
-    {
-        return reuseAddress;
-    }
-
-    public void setReuseAddress( boolean reuseAddress )
-    {
-        this.reuseAddress = reuseAddress;
-    }
-
-    public int getBacklog()
-    {
-        return backlog;
-    }
-
-    public void setBacklog( int backlog )
-    {
-        if( backlog <= 0 )
-        {
-            throw new IllegalArgumentException( "backlog: " + backlog );
-        }
-        this.backlog = backlog;
-    }
-
     private static class RegistrationRequest
     {
         private final IoAddress address;
@@ -552,9 +525,8 @@
     private static class CancellationRequest
     {
         private final IoAddress address;
-
+        private RegistrationRequest registrationRequest;
         private boolean done;
-
         private RuntimeException exception;
         
         private CancellationRequest( IoAddress address )

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java Sun Jan 22 00:56:06 2006
@@ -20,12 +20,14 @@
 
 import java.io.IOException;
 import java.net.ConnectException;
+import java.net.SocketException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.nio.channels.SocketChannel;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.Properties;
 import java.util.Set;
 
 import org.apache.mina.common.ConnectFuture;
@@ -57,19 +59,22 @@
     /**
      * Creates a new instance.
      */
-    public SocketConnector()
+    SocketConnector()
     {
     }
 
     public ConnectFuture connect( IoAddress address, IoAddress localAddress,
                                   IoHandler handler, IoFilterChainBuilder filterChainBuilder )
     {
+        Properties props = address.getProperties();
         SocketChannel ch = null;
         boolean success = false;
         try
         {
             ch = SocketChannel.open();
-            ch.socket().setReuseAddress( true );
+            
+            configureNewChannel( ch, props );
+
             if( localAddress != null )
             {
                 ch.socket().bind( SocketAddresses.parse( localAddress ) );
@@ -107,7 +112,12 @@
             }
         }
         
-        ConnectionRequest request = new ConnectionRequest( ch, /* FIXME getConnectTimeout()*/ 60, handler, filterChainBuilder );
+        
+        ConnectionRequest request = new ConnectionRequest(
+                ch,
+                Integer.parseInt( props.getProperty( Constants.CONNECT_TIMEOUT, "60" ) ),
+                handler, filterChainBuilder );
+
         synchronized( this )
         {
             try
@@ -136,6 +146,48 @@
         
         return request;
     }
+
+    private void configureNewChannel( SocketChannel ch, Properties props ) throws SocketException
+    {
+        ch.socket().setOOBInline( "true".equalsIgnoreCase( props.getProperty( Constants.OOB_INLINE ) ) );
+        if( props.containsKey( Constants.KEEP_ALIVE ) )
+        {
+            ch.socket().setKeepAlive( "true".equalsIgnoreCase( props.getProperty( Constants.KEEP_ALIVE ) ) );
+        }
+        if( props.containsKey( Constants.RECEIVE_BUFFER_SIZE ) )
+        {
+            ch.socket().setReceiveBufferSize(
+                    Integer.parseInt( props.getProperty( Constants.RECEIVE_BUFFER_SIZE ) ) );
+        }
+        if( props.containsKey( Constants.SEND_BUFFER_SIZE ) )
+        {
+            ch.socket().setSendBufferSize(
+                    Integer.parseInt( props.getProperty( Constants.SEND_BUFFER_SIZE ) ) );
+        }
+        if( props.containsKey( Constants.SO_LINGER ) )
+        {
+            String val = props.getProperty( Constants.SO_LINGER );
+            if( val.equalsIgnoreCase( "off" ) )
+            {
+                ch.socket().setSoLinger( false, 0 );
+            }
+            else
+            {
+                ch.socket().setSoLinger( true, Integer.parseInt( val ) );
+            }
+        }
+        if( props.containsKey( Constants.TCP_NO_DELAY ) )
+        {
+            ch.socket().setTcpNoDelay( "true".equalsIgnoreCase( props.getProperty( Constants.TCP_NO_DELAY ) ) );
+        }
+        if( props.containsKey( Constants.TRAFFIC_CLASS ) )
+        {
+            ch.socket().setTrafficClass(
+                    Integer.parseInt( props.getProperty( Constants.TRAFFIC_CLASS ) ) );
+        }
+        ch.socket().setReuseAddress(
+                "true".equalsIgnoreCase( props.getProperty( Constants.REUSE_ADDRESS ) ) );
+    }
     
     private synchronized void startupWorker() throws IOException
     {
@@ -258,16 +310,6 @@
         session.getManagedSessions().add( session );
         session.getIoProcessor().addNew( session );
         return session;
-    }
-
-    public int getProcessors()
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setProcessors( int nProcessor )
-    {
-        throw new UnsupportedOperationException();
     }
 
     private class Worker extends Thread

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java Sun Jan 22 00:56:06 2006
@@ -13,14 +13,12 @@
 
 import org.apache.mina.common.IoAddress;
 import org.apache.mina.common.IoFilterChainBuilder;
+import org.apache.mina.common.IoFuture;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoServiceProvider.IoAcceptor;
 
 /**
- * Binds the specified {@link IoHandler} to the specified
- * {@link VmPipeAddress}.
- * 
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
@@ -73,9 +71,11 @@
             pipe = ( VmPipe ) boundHandlers.remove( address );
         }
         
-        /* FIXME Enable this when configuration interface is ready
         Set managedSessions = pipe.getManagedServerSessions();
-        if( isDisconnectClientsOnUnbind() && managedSessions != null )
+        if( !"false".equalsIgnoreCase(
+                pipe.getAddress().getProperties().getProperty(
+                        "disconnectOnUnbind" ) ) &&
+            managedSessions != null )
         {
             IoSession[] tempSessions = ( IoSession[] ) 
                                   managedSessions.toArray( new IoSession[ 0 ] );
@@ -117,7 +117,6 @@
                 // Ignored
             }
         }
-        */                
     }
 
     public IoSession newSession( IoAddress remoteAddress, IoAddress localAddress )

Modified: directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/common/FutureTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/common/FutureTest.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/common/FutureTest.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/common/FutureTest.java Sun Jan 22 00:56:06 2006
@@ -96,8 +96,8 @@
                 return false;
             }
 
-            public IoServiceProvider getProvider() {
-                // TODO Auto-generated method stub
+            public IoServiceProvider getProvider()
+            {
                 return null;
             }
         };

Modified: directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java Sun Jan 22 00:56:06 2006
@@ -401,8 +401,8 @@
                     return 0;
                 }
 
-                public IoServiceProvider getProvider() {
-                    // TODO Auto-generated method stub
+                public IoServiceProvider getProvider()
+                {
                     return null;
                 }
             } );

Modified: directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java Sun Jan 22 00:56:06 2006
@@ -179,8 +179,8 @@
             return false;
         }
 
-        public IoServiceProvider getProvider() {
-            // TODO Auto-generated method stub
+        public IoServiceProvider getProvider()
+        {
             return null;
         }
     }
@@ -278,8 +278,8 @@
             return false;
         }
 
-        public IoServiceProvider getProvider() {
-            // TODO Auto-generated method stub
+        public IoServiceProvider getProvider()
+        {
             return null;
         }
     }

Modified: directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java Sun Jan 22 00:56:06 2006
@@ -223,8 +223,8 @@
             return false;
         }
 
-        public IoServiceProvider getProvider() {
-            // TODO Auto-generated method stub
+        public IoServiceProvider getProvider()
+        {
             return null;
         }
     }

Modified: directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java Sun Jan 22 00:56:06 2006
@@ -208,8 +208,8 @@
             return 0;
         }
 
-        public IoServiceProvider getProvider() {
-            // TODO Auto-generated method stub
+        public IoServiceProvider getProvider()
+        {
             return null;
         }
     }

Modified: directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java Sun Jan 22 00:56:06 2006
@@ -102,8 +102,8 @@
             return 0;
         }
 
-        public IoServiceProvider getProvider() {
-            // TODO Auto-generated method stub
+        public IoServiceProvider getProvider()
+        {
             return null;
         }
     }

Modified: directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/handler/chain/ChainedIoHandlerTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/handler/chain/ChainedIoHandlerTest.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/handler/chain/ChainedIoHandlerTest.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/handler/chain/ChainedIoHandlerTest.java Sun Jan 22 00:56:06 2006
@@ -81,8 +81,8 @@
                         return 0;
                     }
 
-                    public IoServiceProvider getProvider() {
-                        // TODO Auto-generated method stub
+                    public IoServiceProvider getProvider()
+                    {
                         return null;
                     }
                 }, null );

Modified: directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/AbstractBindTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/AbstractBindTest.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/AbstractBindTest.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/AbstractBindTest.java Sun Jan 22 00:56:06 2006
@@ -28,8 +28,8 @@
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.IoAddress;
 import org.apache.mina.common.IoHandlerAdapter;
-import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoService;
+import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoServiceProvider.IoAcceptor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,12 +48,10 @@
     {
     }
     
-    protected abstract IoAddress createAddress( int port );
+    protected abstract IoAddress createAddress( int port, boolean reuseAddress );
     
     protected void bind( boolean reuseAddress ) throws IOException
     {
-        setReuseAddress( reuseAddress );
-
         // Find an availble test port and bind to it.
         boolean socketBound = false;
 
@@ -65,7 +63,7 @@
             socketBound = false;
             try
             {
-                IoService.bind( createAddress( port ), new EchoProtocolHandler() );
+                IoService.bind( createAddress( port, reuseAddress ), new EchoProtocolHandler() );
                 socketBound = true;
                 break;
             }
@@ -83,26 +81,11 @@
         //System.out.println( "Using port " + port + " for testing." );
     }
 
-    private void setReuseAddress( boolean reuseAddress )
-    {
-        // FIXME later when configuration interface is ready
-        /*
-        if( acceptor instanceof DatagramAcceptor )
-        {
-            ( ( DatagramAcceptor ) acceptor ).setReuseAddress( reuseAddress );
-        }
-        else if( acceptor instanceof SocketAcceptor )
-        {
-            ( ( SocketAcceptor ) acceptor ).setReuseAddress( reuseAddress );
-        }
-        */
-    }
-    
     public void tearDown()
     {
         try
         {
-            IoService.unbind( createAddress( port ) );
+            IoService.unbind( createAddress( port, false ) );
         }
         catch( Exception e )
         {
@@ -116,7 +99,7 @@
         
         try
         {
-            IoService.bind( createAddress( port ), new EchoProtocolHandler() );
+            IoService.bind( createAddress( port, false ), new EchoProtocolHandler() );
             Assert.fail( "IOException is not thrown" );
         }
         catch( IOException e )
@@ -129,12 +112,12 @@
         bind( false );
         
         // this should succeed
-        IoService.unbind( createAddress( port ) );
+        IoService.unbind( createAddress( port, false ) );
         
         try
         {
             // this should fail
-            IoService.unbind( createAddress( port ) );
+            IoService.unbind( createAddress( port, false ) );
             Assert.fail( "Exception is not thrown" );
         }
         catch( Exception e )
@@ -146,7 +129,7 @@
     {
         bind( true );
         
-        IoAddress addr = createAddress( port );
+        IoAddress addr = createAddress( port, true );
         EchoProtocolHandler handler = new EchoProtocolHandler();
         for( int i = 0; i < 1024; i++ ) 
         {
@@ -157,9 +140,7 @@
     
     public void _testRegressively() throws IOException
     {
-        setReuseAddress( true );
-
-        IoAddress addr = createAddress( port );
+        IoAddress addr = createAddress( port, true );
         EchoProtocolHandler handler = new EchoProtocolHandler();
         for( int i = 0; i < 1048576; i++ )
         {

Modified: directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramBindTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramBindTest.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramBindTest.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramBindTest.java Sun Jan 22 00:56:06 2006
@@ -33,8 +33,10 @@
     {
     }
 
-    protected IoAddress createAddress( int port )
+    protected IoAddress createAddress( int port, boolean reuseAddress )
     {
-        return new IoAddress( "nio:datagram:*:" + port );
+        return new IoAddress(
+                "nio:datagram:*:" + port +
+                "?reuseAddress=" + ( reuseAddress? "true" : "false" ) );
     }    
 }

Modified: directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/socket/nio/SocketBindTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/socket/nio/SocketBindTest.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/socket/nio/SocketBindTest.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/socket/nio/SocketBindTest.java Sun Jan 22 00:56:06 2006
@@ -18,7 +18,15 @@
  */
 package org.apache.mina.transport.socket.nio;
 
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.mina.common.ConnectFuture;
 import org.apache.mina.common.IoAddress;
+import org.apache.mina.common.IoHandlerAdapter;
+import org.apache.mina.common.IoService;
+import org.apache.mina.common.IoSession;
 import org.apache.mina.transport.AbstractBindTest;
 
 /**
@@ -29,24 +37,25 @@
  */
 public class SocketBindTest extends AbstractBindTest
 {
-    protected IoAddress createAddress( int port )
+    protected IoAddress createAddress( int port, boolean reuseAddress )
     {
-        return new IoAddress( "nio:socket:*:" + port );
+        return new IoAddress(
+                "nio:socket:*:" + port +
+                "?reuseAddress=" + ( reuseAddress? "true" : "false" ) );
     }
     
-    /* FIXME I'll fix this later
     public void testUnbindDisconnectsClients() throws Exception
     {
         // TODO: This test is almost identical to the test with the same name in VmPipeBindTest
         bind( false );
         
-        IoAddress addr = createAddress( port );
+        IoAddress addr = createAddress( port, false );
      
-        IoConnector connector = new SocketConnector();
         IoSession[] sessions = new IoSession[ 5 ];
         for( int i = 0; i < sessions.length; i++ )
         {
-            ConnectFuture future = connector.connect( new InetSocketAddress( "localhost", port ), new IoHandlerAdapter() );
+            ConnectFuture future = IoService.connect(
+                    "nio:socket:localhost:" + port, new IoHandlerAdapter() );
             future.join();
             sessions[ i ] = future.getSession();
             Assert.assertTrue( sessions[ i ].isConnected() );
@@ -55,10 +64,10 @@
         // Wait for the server side sessions to be created.
         Thread.sleep( 500 );
         
-        Collection managedSessions = acceptor.getManagedSessions( addr );
+        Collection managedSessions = IoService.getManagedSessions( addr );
         Assert.assertEquals( 5, managedSessions.size() );
         
-        acceptor.unbind( addr );
+        IoService.unbind( addr );
         
         // Wait for the client side sessions to close.
         Thread.sleep( 500 );
@@ -68,5 +77,4 @@
             Assert.assertFalse( sessions[ i ].isConnected() );
         }
     }
-    */
 }

Modified: directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/vmpipe/VmPipeBindTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/vmpipe/VmPipeBindTest.java?rev=371243&r1=371242&r2=371243&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/vmpipe/VmPipeBindTest.java (original)
+++ directory/sandbox/trustin/mina-spi/core/src/test/java/org/apache/mina/transport/vmpipe/VmPipeBindTest.java Sun Jan 22 00:56:06 2006
@@ -18,7 +18,15 @@
  */
 package org.apache.mina.transport.vmpipe;
 
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.mina.common.ConnectFuture;
 import org.apache.mina.common.IoAddress;
+import org.apache.mina.common.IoHandlerAdapter;
+import org.apache.mina.common.IoService;
+import org.apache.mina.common.IoSession;
 import org.apache.mina.transport.AbstractBindTest;
 
 /**
@@ -29,24 +37,23 @@
  */
 public class VmPipeBindTest extends AbstractBindTest
 {
-    protected IoAddress createAddress( int port )
+    protected IoAddress createAddress( int port, boolean reuseAddress )
     {
-        return new IoAddress( "vm:pipe:" + port );
+        return new IoAddress(
+                "vm:pipe:" + port + "?reuseAddress=" + ( reuseAddress? "true" : "false" ) );
     }
     
-    /* FIXME I'll fix this later
     public void testUnbindDisconnectsClients() throws Exception
     {
         // TODO: This test is almost identical to the test with the same name in SocketBindTest
         bind( false );
         
-        SocketAddress addr = createSocketAddress( port );
+        IoAddress addr = createAddress( port, false );
      
-        IoConnector connector = new VmPipeConnector();
         IoSession[] sessions = new IoSession[ 5 ];
         for( int i = 0; i < sessions.length; i++ )
         {
-            ConnectFuture future = connector.connect( addr, new IoHandlerAdapter() );
+            ConnectFuture future = IoService.connect( addr, new IoHandlerAdapter() );
             future.join();
             sessions[ i ] = future.getSession();
             Assert.assertTrue( sessions[ i ].isConnected() );
@@ -55,7 +62,7 @@
         // Wait for the server side sessions to be created.
         Thread.sleep( 500 );
         
-        Collection managedSessions = acceptor.getManagedSessions( addr );
+        Collection managedSessions = IoService.getManagedSessions( addr );
         Assert.assertEquals( 5, managedSessions.size() );
         // Make sure it's the server side sessions we get when calling getManagedSessions()
         for( int i = 0; i < sessions.length; i++ )
@@ -63,7 +70,7 @@
             Assert.assertFalse( managedSessions.contains( sessions[ i ] ) );
         }
         
-        acceptor.unbind( addr );
+        IoService.unbind( addr );
         
         // Wait for the client side sessions to close.
         Thread.sleep( 500 );
@@ -73,5 +80,4 @@
             Assert.assertFalse( sessions[ i ].isConnected() );
         }
     }
-    */
 }



Mime
View raw message