private void writeMethodReturn(ByteBuffer buffer, RemoteMethodReturnMessage ret) throws IOException{
        buffer.putShort(ret.invocationID);
        if (ret.retVal != null){
            buffer.put((byte)0x01);
            Serializer.writeClassAndObject(buffer, ret.retVal);
        }else{
            buffer.put((byte)0x00);
        }
    }
{@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