@Override
    public Message pollMessage() {
        if( messages.isEmpty() ) {
            return null;
        }
        ByteBuffer bytes = messages.removeFirst();
        return protocol.toMessage(bytes);                
    }
Returns the next message in the buffer or null if there are no more
 messages in the buffer.
jme3-networking/src/main/java/com/jme3/network/base/protocol/LazyMessageBuffer.java