private RemoteMethodCallMessage readMethodCall(ByteBuffer buffer) throws IOException{
        RemoteMethodCallMessage call = new RemoteMethodCallMessage();
        call.objectId = buffer.getShort();
        call.methodId = buffer.getShort();
        call.invocationId = buffer.getShort();
        int numArgs = buffer.get() & 0xff;
        if (numArgs > 0){
            Object[] args = new Object[numArgs];
            for (int i = 0; i < numArgs; i++){
                if (buffer.get() == (byte)0x01){
                    args[i] = Serializer.readClassAndObject(buffer);
                }
            }
            call.args = args;
        }
        return call;
    }
{@link RmiSerializer} is responsible for serializing RMI messages
like define object, call, and return.

@author Kirill Vainer
jme3-networking/src/main/java/com/jme3/network/rmi/RmiSerializer.java