@Override
    public ByteBuffer read()
    {
        checkClosed();
        
        try {
            // Read what we can
            int count = in.read(buffer);
            if( count < 0 ) {
                // Socket is closed
                close();
                return null;
            }

            // Wrap it in a ByteBuffer for the caller
            return ByteBuffer.wrap( buffer, 0, count ); 
        } catch( IOException e ) {
            if( !connected.get() ) {
                // Nothing to see here... just move along
                return null;
            }        
            throw new ConnectorException( "Error reading from connection to:" + remoteAddress, e );    
        }                
    }
A straight forward socket-based connector implementation that
 does not use any separate threading.  It relies completely on
 the buffering in the OS network layer.

 @version   $Revision$
 @author    Paul Speed
jme3-networking/src/main/java/com/jme3/network/kernel/tcp/SocketConnector.java