@Override
    public int addChannel( int port )
    {
        if( isRunning )
            throw new IllegalStateException( "Channels cannot be added once server is started." );
 
        // Note: it does bug me that channels aren't 100% universal and
        // set up externally, but it requires a more invasive set of changes
        // for "connection types" and some kind of registry of kernel and
        // connector factories.  This really would be the best approach and
        // would allow all kinds of channel customization maybe... but for
        // now, we hard-code the standard connections and treat the +2 extras
        // differently.
            
        // Check for consistency with the channels list
        if( channels.size() - CH_FIRST != alternatePorts.size() )
            throw new IllegalStateException( "Channel and port lists do not match." ); 
            
        try {                                
            int result = alternatePorts.size(); 
            alternatePorts.add(port);
            
            Kernel kernel = kernelFactory.createKernel(result, port); 
            channels.add( new KernelAdapter(this, kernel, protocol, dispatcher, true) );
            
            return result;
        } catch( IOException e ) {
            throw new RuntimeException( "Error adding channel for port:" + port, e );
        } 
    }
A default implementation of the Server interface that delegates
 its network connectivity to kernel.Kernel.

 @version   $Revision$
 @author    Paul Speed
jme3-networking/src/main/java/com/jme3/network/base/DefaultServer.java