com.jme3.network.serializing.Serializer Java Examples

The following examples show how to use com.jme3.network.serializing.Serializer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageProtocol.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 *  Converts a message to a ByteBuffer using the Serializer
 *  and the (short length) + data protocol.  If target is null
 *  then a 32k byte buffer will be created and filled.
 */
public static ByteBuffer messageToBuffer( Message message, ByteBuffer target )
{
    // Could let the caller pass their own in       
    ByteBuffer buffer = target == null ? ByteBuffer.allocate( 32767 + 2 ) : target;
    
    try {
        buffer.position( 2 );
        Serializer.writeClassAndObject( buffer, message );
        buffer.flip();
        short dataLength = (short)(buffer.remaining() - 2);
        buffer.putShort( dataLength );
        buffer.position( 0 );
        
        return buffer;
    } catch( IOException e ) {
        throw new RuntimeException( "Error serializing message", e );
    }
}
 
Example #2
Source File: TestThroughput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static void main(String[] args) throws IOException, InterruptedException {

        Serializer.registerClass(TestMessage.class);

        // Use this to test the client/server name version check
        //Server server = Network.createServer( "bad name", 42, 5110, 5110 );
        Server server = Network.createServer(5110, 5110);
        server.start();

        Client client = Network.connectToServer("localhost", 5110);
        client.start();

        client.addMessageListener(new TestThroughput(false), TestMessage.class);
        server.addMessageListener(new TestThroughput(true), TestMessage.class);

        Thread.sleep(1);

        TestMessage test = new TestMessage();
//        for( int i = 0; i < 10; i++ ) {
        while (true) {
//System.out.println( "sending." );
            client.send(test);
        }

        //Thread.sleep(5000);
    }
 
Example #3
Source File: TestMessages.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static void main(String[] args) throws IOException, InterruptedException{
    Serializer.registerClass(PingMessage.class);
    Serializer.registerClass(PongMessage.class);

    Server server = Network.createServer(5110);
    server.start();

    Client client = Network.connectToServer("localhost", 5110);
    client.start();

    server.addMessageListener(new ServerPingResponder(), PingMessage.class);
    client.addMessageListener(new ClientPingResponder(), PongMessage.class);

    System.out.println("Client: Sending ping message..");
    client.send(new PingMessage());
    
    Object obj = new Object();
    synchronized (obj){
        obj.wait();
    }
}
 
Example #4
Source File: ArraySerializer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void writeArray(Serializer elementSerializer, ByteBuffer buffer, Object array, int dimension, int dimensionCount) throws IOException {
    int length = Array.getLength(array);
    if (dimension > 0) {
        buffer.putInt(length);
    }
    // Write array data.
    boolean elementsAreArrays = dimension < dimensionCount - 1;
    for (int i = 0; i < length; i++) {
        Object element = Array.get(array, i);
        if (elementsAreArrays) {
            if (element != null) writeArray(elementSerializer, buffer, element, dimension + 1, dimensionCount);
        } else if (elementSerializer != null) {
            elementSerializer.writeObject(buffer, element);
        } else {
            // Each element could be a different type. Store the class with the object.
            Serializer.writeClassAndObject(buffer, element);
        }
    }
}
 
Example #5
Source File: ArraySerializer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void writeObject(ByteBuffer buffer, Object object) throws IOException {
    if (object == null){
        buffer.put((byte)0);
        return;
    }

    int[] dimensions = getDimensions(object);
    buffer.put((byte)dimensions.length);
    for (int dimension : dimensions) buffer.putInt(dimension);
    Serializer elementSerializer = null;

    Class elementClass = object.getClass();
    while (elementClass.getComponentType() != null) {
        elementClass = elementClass.getComponentType();
    }

    if (Modifier.isFinal(elementClass.getModifiers())) elementSerializer = Serializer.getSerializer(elementClass);
    writeArray(elementSerializer, buffer, object, 0, dimensions.length);
}
 
Example #6
Source File: ArraySerializer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
    byte dimensionCount = data.get();
    if (dimensionCount == 0)
        return null;

    int[] dimensions = new int[dimensionCount];
    for (int i = 0; i < dimensionCount; i++)
            dimensions[i] = data.getInt();

    Serializer elementSerializer = null;

    Class elementClass = c;
    while (elementClass.getComponentType() != null)
        elementClass = elementClass.getComponentType();

    if (Modifier.isFinal(elementClass.getModifiers())) elementSerializer = Serializer.getSerializer(elementClass);
    // Create array and read in the data.
    T array = (T)Array.newInstance(elementClass, dimensions);
    readArray(elementSerializer, elementClass, data, array, 0, dimensions);
    return array;
}
 
Example #7
Source File: GZIPSerializer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void writeObject(ByteBuffer buffer, Object object) throws IOException {
    if (!(object instanceof GZIPCompressedMessage)) return;
    Message message = ((GZIPCompressedMessage)object).getMessage();

    ByteBuffer tempBuffer = ByteBuffer.allocate(512000);
    Serializer.writeClassAndObject(tempBuffer, message);

    ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
    GZIPOutputStream gzipOutput = new GZIPOutputStream(byteArrayOutput);

    tempBuffer.flip();
    gzipOutput.write(tempBuffer.array(), 0, tempBuffer.limit());
    gzipOutput.flush();
    gzipOutput.finish();
    gzipOutput.close();

    buffer.put(byteArrayOutput.toByteArray());
}
 
Example #8
Source File: RmiSerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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;
}
 
Example #9
Source File: ZIPSerializer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void writeObject(ByteBuffer buffer, Object object) throws IOException {
    if (!(object instanceof ZIPCompressedMessage)) return;

    ZIPCompressedMessage zipMessage = (ZIPCompressedMessage)object;
    Message message = zipMessage.getMessage();
    ByteBuffer tempBuffer = ByteBuffer.allocate(512000);
    Serializer.writeClassAndObject(tempBuffer, message);

    ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
    ZipOutputStream zipOutput = new ZipOutputStream(byteArrayOutput);
    zipOutput.setLevel(zipMessage.getLevel());

    ZipEntry zipEntry = new ZipEntry("zip");

    zipOutput.putNextEntry(zipEntry);
    tempBuffer.flip();
    zipOutput.write(tempBuffer.array(), 0, tempBuffer.limit());
    zipOutput.flush();
    zipOutput.closeEntry();
    zipOutput.close();

    buffer.put(byteArrayOutput.toByteArray());
}
 
Example #10
Source File: SerializerMessageProtocol.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 *  Converts a message to a ByteBuffer using the com.jme3.network.serializing.Serializer
 *  and the (short length) + data protocol.  If target is null
 *  then a 32k byte buffer will be created and filled.
 */
@Override
public ByteBuffer toByteBuffer( Message message, ByteBuffer target ) {

    // Could let the caller pass their own in       
    ByteBuffer buffer = target == null ? ByteBuffer.allocate(32767 + 2) : target;
    
    try {
        buffer.position(2);
        Serializer.writeClassAndObject(buffer, message);
        buffer.flip();
        short dataLength = (short)(buffer.remaining() - 2);
        buffer.putShort(dataLength);
        buffer.position(0);
        
        return buffer;
    } catch( IOException e ) {
        throw new RuntimeException("Error serializing message", e);
    }
}
 
Example #11
Source File: RmiSerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void writeMethodCall(ByteBuffer buffer, RemoteMethodCallMessage call) throws IOException{
    buffer.putShort((short)call.objectId);
    buffer.putShort(call.methodId);
    buffer.putShort(call.invocationId);
    if (call.args == null){
        buffer.put((byte)0);
    }else{
        buffer.put((byte)call.args.length);

        // Right now it writes 0 for every null argument
        // and 1 for every non-null argument followed by the serialized
        // argument. For the future, using a bit set should be considered.
        for (Object obj : call.args){
            if (obj != null){
                buffer.put((byte)0x01);
                Serializer.writeClassAndObject(buffer, obj);
            }else{
                buffer.put((byte)0x00);
            }
        }
    }
}
 
Example #12
Source File: ZIPSerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void writeObject(ByteBuffer buffer, Object object) throws IOException {
    if (!(object instanceof ZIPCompressedMessage)) return;

    ZIPCompressedMessage zipMessage = (ZIPCompressedMessage)object;
    Message message = zipMessage.getMessage();
    ByteBuffer tempBuffer = ByteBuffer.allocate(512000);
    Serializer.writeClassAndObject(tempBuffer, message);

    ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
    ZipOutputStream zipOutput = new ZipOutputStream(byteArrayOutput);
    zipOutput.setLevel(zipMessage.getLevel());

    ZipEntry zipEntry = new ZipEntry("zip");

    zipOutput.putNextEntry(zipEntry);
    zipOutput.write(tempBuffer.array());
    zipOutput.flush();
    zipOutput.closeEntry();
    zipOutput.close();

    buffer.put(byteArrayOutput.toByteArray());
}
 
Example #13
Source File: ClientSerializerRegistrationsService.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
protected void onInitialize( ClientServiceManager serviceManager ) {

    // Make sure our message type is registered if it isn't already
    if( Serializer.getExactSerializerRegistration(SerializerRegistrationsMessage.class) == null ) {
        // This is the minimum we'd need just to be able to register
        // the rest... otherwise we can't even receive this message.
        Serializer.registerClass(SerializerRegistrationsMessage.class);
        Serializer.registerClass(SerializerRegistrationsMessage.Registration.class);
    } else {
        log.log(Level.INFO, "Skipping registration of SerializerRegistrationsMessage.");
    }
    
    // Add our listener for that message type
    serviceManager.getClient().addMessageListener(this, SerializerRegistrationsMessage.class); 
}
 
Example #14
Source File: GZIPSerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void writeObject(ByteBuffer buffer, Object object) throws IOException {
    if (!(object instanceof GZIPCompressedMessage)) return;
    Message message = ((GZIPCompressedMessage)object).getMessage();

    ByteBuffer tempBuffer = ByteBuffer.allocate(512000);
    Serializer.writeClassAndObject(tempBuffer, message);

    ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
    GZIPOutputStream gzipOutput = new GZIPOutputStream(byteArrayOutput);

    gzipOutput.write(tempBuffer.array());
    gzipOutput.flush();
    gzipOutput.finish();
    gzipOutput.close();

    buffer.put(byteArrayOutput.toByteArray());
}
 
Example #15
Source File: ArraySerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
    byte dimensionCount = data.get();
    if (dimensionCount == 0)
        return null;

    int[] dimensions = new int[dimensionCount];
    for (int i = 0; i < dimensionCount; i++)
            dimensions[i] = data.getInt();

    Serializer elementSerializer = null;

    Class elementClass = c;
    while (elementClass.getComponentType() != null)
        elementClass = elementClass.getComponentType();

    if (Modifier.isFinal(elementClass.getModifiers())) elementSerializer = Serializer.getSerializer(elementClass);
    // Create array and read in the data.
    T array = (T)Array.newInstance(elementClass, dimensions);
    readArray(elementSerializer, elementClass, data, array, 0, dimensions);
    return array;
}
 
Example #16
Source File: ArraySerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void writeObject(ByteBuffer buffer, Object object) throws IOException {
    if (object == null){
        buffer.put((byte)0);
        return;
    }

    int[] dimensions = getDimensions(object);
    buffer.put((byte)dimensions.length);
    for (int dimension : dimensions) buffer.putInt(dimension);
    Serializer elementSerializer = null;

    Class elementClass = object.getClass();
    while (elementClass.getComponentType() != null) {
        elementClass = elementClass.getComponentType();
    }

    if (Modifier.isFinal(elementClass.getModifiers())) elementSerializer = Serializer.getSerializer(elementClass);
    writeArray(elementSerializer, buffer, object, 0, dimensions.length);
}
 
Example #17
Source File: ArraySerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void writeArray(Serializer elementSerializer, ByteBuffer buffer, Object array, int dimension, int dimensionCount) throws IOException {
    int length = Array.getLength(array);
    if (dimension > 0) {
        buffer.putInt(length);
    }
    // Write array data.
    boolean elementsAreArrays = dimension < dimensionCount - 1;
    for (int i = 0; i < length; i++) {
        Object element = Array.get(array, i);
        if (elementsAreArrays) {
            if (element != null) writeArray(elementSerializer, buffer, element, dimension + 1, dimensionCount);
        } else if (elementSerializer != null) {
            elementSerializer.writeObject(buffer, element);
        } else {
            // Each element could be a different type. Store the class with the object.
            Serializer.writeClassAndObject(buffer, element);
        }
    }
}
 
Example #18
Source File: TestMessages.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static void main(String[] args) throws IOException, InterruptedException{
    Serializer.registerClass(PingMessage.class);
    Serializer.registerClass(PongMessage.class);

    Server server = Network.createServer(5110);
    server.start();

    Client client = Network.connectToServer("localhost", 5110);
    client.start();

    server.addMessageListener(new ServerPingResponder(), PingMessage.class);
    client.addMessageListener(new ClientPingResponder(), PongMessage.class);

    System.out.println("Client: Sending ping message..");
    client.send(new PingMessage());
    
    Object obj = new Object();
    synchronized (obj){
        obj.wait();
    }
}
 
Example #19
Source File: RmiSerializer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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;
}
 
Example #20
Source File: RmiSerializer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void writeMethodCall(ByteBuffer buffer, RemoteMethodCallMessage call) throws IOException{
    buffer.putShort((short)call.objectId);
    buffer.putShort(call.methodId);
    buffer.putShort(call.invocationId);
    if (call.args == null){
        buffer.put((byte)0);
    }else{
        buffer.put((byte)call.args.length);

        // Right now it writes 0 for every null argument
        // and 1 for every non-null argument followed by the serialized
        // argument. For the future, using a bit set should be considered.
        for (Object obj : call.args){
            if (obj != null){
                buffer.put((byte)0x01);
                Serializer.writeClassAndObject(buffer, obj);
            }else{
                buffer.put((byte)0x00);
            }
        }
    }
}
 
Example #21
Source File: TestThroughput.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static void main(String[] args) throws IOException, InterruptedException {

        Serializer.registerClass(TestMessage.class);

        // Use this to test the client/server name version check
        //Server server = Network.createServer( "bad name", 42, 5110, 5110 );
        Server server = Network.createServer(5110, 5110);
        server.start();

        Client client = Network.connectToServer("localhost", 5110);
        client.start();

        client.addMessageListener(new TestThroughput(false), TestMessage.class);
        server.addMessageListener(new TestThroughput(true), TestMessage.class);

        Thread.sleep(1);

        TestMessage test = new TestMessage();
//        for( int i = 0; i < 10; i++ ) {
        while (true) {
//System.out.println( "sending." );
            client.send(test);
        }

        //Thread.sleep(5000);
    }
 
Example #22
Source File: SerializerRegistrationsMessage.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void registerAll() {

        // See if we will have problems because our registry is locked        
        if( Serializer.isReadOnly() ) {
            // Check to see if maybe we are executing this from the
            // same JVM that sent the message, ie: client and server are running on
            // the same JVM
            // There could be more advanced checks than this but for now we'll
            // assume that if the registry was compiled here then it means
            // we are also the server process.  Note that this wouldn't hold true
            // under complicated examples where there are clients of one server
            // that also run their own servers but realistically they would have
            // to disable the ServerSerializerRegistrationsServer anyway.
            if( compiled != null ) {
                log.log(Level.INFO, "Skipping registration as registry is locked, presumably by a local server process.");
                return;
            }
        }
        
        log.log(Level.FINE, "Registering {0} classes...", registrations.length);
        for( Registration reg : registrations ) {
            log.log(Level.INFO, "Registering:{0}", reg);
            reg.register();
        }
        log.log(Level.FINE, "Done registering serializable classes.");
    }
 
Example #23
Source File: RmiSerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Class<?> readType(ByteBuffer buffer) throws IOException{
    SerializerRegistration reg = Serializer.readClass(buffer);
    if (reg == null){
        // either "void" or unknown val
        short id = buffer.getShort(buffer.position()-2);
        if (id == 0){
            return void.class;
        } else{
            logger.log(Level.WARNING, "Undefined class ID: {0}", id);
            throw new IOException(); // prevents message from being serialized
        }
    }
    return reg.getType();
}
 
Example #24
Source File: RmiSerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void writeType(ByteBuffer buffer, Class<?> clazz) throws IOException{
    if (clazz == void.class){
        buffer.putShort((short)0);
    } else {
        SerializerRegistration reg = Serializer.getSerializerRegistration(clazz);
        if (reg == null){
            logger.log(Level.WARNING, "Unknown class: {0}", clazz);
            throw new IOException(); // prevents message from being serialized
        }
        buffer.putShort(reg.getId());
    }
}
 
Example #25
Source File: ZIPSerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
    try
    {
        ZIPCompressedMessage result = new ZIPCompressedMessage();

        byte[] byteArray = new byte[data.remaining()];

        data.get(byteArray);

        ZipInputStream in = new ZipInputStream(new ByteArrayInputStream(byteArray));
        in.getNextEntry();
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        byte[] tmp = new byte[9012];
        int read;

        while (in.available() > 0 && ((read = in.read(tmp)) > 0)) {
            out.write(tmp, 0, read);
        }

        in.closeEntry();
        out.flush();
        in.close();

        result.setMessage((Message)Serializer.readClassAndObject(ByteBuffer.wrap(out.toByteArray())));
        return (T)result;
    }
    catch (Exception e) {
        e.printStackTrace();
        throw new IOException(e.toString());
    }
}
 
Example #26
Source File: RmiSerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
    }
}
 
Example #27
Source File: RmiSerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private RemoteMethodReturnMessage readMethodReturn(ByteBuffer buffer) throws IOException{
    RemoteMethodReturnMessage ret = new RemoteMethodReturnMessage();
    ret.invocationID = buffer.getShort();
    if (buffer.get() == (byte)0x01){
        ret.retVal = Serializer.readClassAndObject(buffer);
    }
    return ret;
}
 
Example #28
Source File: TestRemoteCall.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void main(String[] args) throws IOException, InterruptedException{
    Serializer.registerClass(Savable.class, new SavableSerializer());

    createServer();

    Client client = Network.connectToServer("localhost", 5110);
    client.start();

    ObjectStore store = new ObjectStore(client);
    ServerAccess access = store.getExposedObject("access", ServerAccess.class, true);
    boolean result = access.attachChild("Models/Oto/Oto.mesh.xml");
    System.out.println(result);
}
 
Example #29
Source File: GZIPSerializer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
    try
    {
        GZIPCompressedMessage result = new GZIPCompressedMessage();

        byte[] byteArray = new byte[data.remaining()];

        data.get(byteArray);

        GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(byteArray));
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        byte[] tmp = new byte[9012];
        int read;

        while (in.available() > 0 && ((read = in.read(tmp)) > 0)) {
            out.write(tmp, 0, read);
        }

        result.setMessage((Message)Serializer.readClassAndObject(ByteBuffer.wrap(out.toByteArray())));
        return (T)result;
    }
    catch (Exception e) {
        e.printStackTrace();
        throw new IOException(e.toString());
    }
}
 
Example #30
Source File: TestRemoteCall.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void main(String[] args) throws IOException, InterruptedException{
    Serializer.registerClass(Savable.class, new SavableSerializer());

    createServer();

    Client client = Network.connectToServer("localhost", 5110);
    client.start();

    ObjectStore store = new ObjectStore(client);
    ServerAccess access = store.getExposedObject("access", ServerAccess.class, true);
    boolean result = access.attachChild("Models/Oto/Oto.mesh.xml");
    System.out.println(result);
}