@Override
    @SuppressWarnings("unchecked")
    public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
        if (c == RemoteObjectDefMessage.class){
            return (T) readObjectDefs(data);
        }else if (c == RemoteMethodCallMessage.class){
            return (T) readMethodCall(data);
        }else if (c == RemoteMethodReturnMessage.class){
            return (T) readMethodReturn(data);
        }
        return null;
    }
{@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