public override bool ice_invoke(byte[] inParams, out byte[] outParams, Ice.Current current)
    {
        Ice.Communicator communicator = current.adapter.getCommunicator();
        Ice.OutputStream @out         = new Ice.OutputStream(communicator);
        @out.startEncapsulation(current.encoding, Ice.FormatType.DefaultFormat);
        AlsoEmpty ae = new AlsoEmpty();

        @out.writeValue(ae);
        @out.writePendingValues();
        @out.endEncapsulation();
        outParams = @out.finished();
        return(true);
    }
예제 #2
0
    private static int run(Ice.Communicator communicator)
    {
        var obj = communicator.propertyToProxy("Printer.Proxy");

        menu();

        string line = null;

        do
        {
            try
            {
                Console.Write("==> ");
                Console.Out.Flush();
                line = Console.In.ReadLine();
                if (line == null)
                {
                    break;
                }

                byte[] outParams;

                if (line.Equals("1"))
                {
                    //
                    // Marshal the in parameter.
                    //
                    var outStream = new Ice.OutputStream(communicator);
                    outStream.startEncapsulation();
                    outStream.writeString("The streaming API works!");
                    outStream.endEncapsulation();

                    //
                    // Invoke operation.
                    //
                    if (!obj.ice_invoke("printString", Ice.OperationMode.Normal, outStream.finished(),
                                        out outParams))
                    {
                        Console.Error.WriteLine("Unknown user exception");
                    }
                }
                else if (line.Equals("2"))
                {
                    //
                    // Marshal the in parameter.
                    //
                    var outStream = new Ice.OutputStream(communicator);
                    outStream.startEncapsulation();
                    string[] arr = { "The", "streaming", "API", "works!" };
                    StringSeqHelper.write(outStream, arr);
                    outStream.endEncapsulation();

                    //
                    // Invoke operation.
                    //
                    if (!obj.ice_invoke("printStringSequence", Ice.OperationMode.Normal, outStream.finished(),
                                        out outParams))
                    {
                        Console.Error.WriteLine("Unknown user exception");
                    }
                }
                else if (line.Equals("3"))
                {
                    //
                    // Marshal the in parameter.
                    //
                    var outStream = new Ice.OutputStream(communicator);
                    outStream.startEncapsulation();
                    var dict = new Dictionary <string, string>()
                    {
                        { "The", "streaming" },
                        { "API", "works!" }
                    };
                    StringDictHelper.write(outStream, dict);
                    outStream.endEncapsulation();

                    //
                    // Invoke operation.
                    //
                    if (!obj.ice_invoke("printDictionary", Ice.OperationMode.Normal, outStream.finished(),
                                        out outParams))
                    {
                        Console.Error.WriteLine("Unknown user exception");
                    }
                }
                else if (line.Equals("4"))
                {
                    //
                    // Marshal the in parameter.
                    //
                    var outStream = new Ice.OutputStream(communicator);
                    outStream.startEncapsulation();
                    ColorHelper.write(outStream, Color.green);
                    outStream.endEncapsulation();

                    //
                    // Invoke operation.
                    //
                    if (!obj.ice_invoke("printEnum", Ice.OperationMode.Normal, outStream.finished(), out outParams))
                    {
                        Console.Error.WriteLine("Unknown user exception");
                    }
                }
                else if (line.Equals("5"))
                {
                    //
                    // Marshal the in parameter.
                    //
                    var outStream = new Ice.OutputStream(communicator);
                    outStream.startEncapsulation();
                    var s = new Structure("red", Color.red);
                    Structure.ice_write(outStream, s);
                    outStream.endEncapsulation();

                    //
                    // Invoke operation.
                    //
                    if (!obj.ice_invoke("printStruct", Ice.OperationMode.Normal, outStream.finished(),
                                        out outParams))
                    {
                        Console.Error.WriteLine("Unknown user exception");
                    }
                }
                else if (line.Equals("6"))
                {
                    //
                    // Marshal the in parameter.
                    //
                    var outStream = new Ice.OutputStream(communicator);
                    outStream.startEncapsulation();
                    Structure[] arr =
                    {
                        new Structure("red",   Color.red),
                        new Structure("green", Color.green),
                        new Structure("blue",  Color.blue)
                    };
                    StructureSeqHelper.write(outStream, arr);
                    outStream.endEncapsulation();

                    //
                    // Invoke operation.
                    //
                    if (!obj.ice_invoke("printStructSequence", Ice.OperationMode.Normal, outStream.finished(),
                                        out outParams))
                    {
                        Console.Error.WriteLine("Unknown user exception");
                    }
                }
                else if (line.Equals("7"))
                {
                    //
                    // Marshal the in parameter.
                    //
                    Ice.OutputStream outStream = new Ice.OutputStream(communicator);
                    outStream.startEncapsulation();
                    var c = new C(new Structure("blue", Color.blue));
                    outStream.writeValue(c);
                    outStream.writePendingValues();
                    outStream.endEncapsulation();

                    //
                    // Invoke operation.
                    //
                    if (!obj.ice_invoke("printClass", Ice.OperationMode.Normal, outStream.finished(), out outParams))
                    {
                        Console.Error.WriteLine("Unknown user exception");
                    }
                }
                else if (line.Equals("8"))
                {
                    //
                    // Invoke operation.
                    //
                    if (!obj.ice_invoke("getValues", Ice.OperationMode.Normal, null, out outParams))
                    {
                        Console.Error.WriteLine("Unknown user exception");
                        continue;
                    }

                    //
                    // Unmarshal the results.
                    //
                    var inStream = new Ice.InputStream(communicator, outParams);
                    inStream.startEncapsulation();
                    var cb = new ReadValueCallback();
                    inStream.readValue(cb.invoke);
                    var str = inStream.readString();
                    inStream.readPendingValues();
                    var c = cb.obj as C;
                    Console.Error.WriteLine("Got string `" + str + "' and class: s.name=" + c.s.name +
                                            ", s.value=" + c.s.value);
                }
                else if (line.Equals("9"))
                {
                    //
                    // Invoke operation.
                    //
                    if (obj.ice_invoke("throwPrintFailure", Ice.OperationMode.Normal, null, out outParams))
                    {
                        Console.Error.WriteLine("Expected exception");
                        continue;
                    }

                    var inStream = new Ice.InputStream(communicator, outParams);
                    inStream.startEncapsulation();
                    try
                    {
                        inStream.throwException();
                    }
                    catch (PrintFailure)
                    {
                        // Expected.
                    }
                    catch (Ice.UserException)
                    {
                        Console.Error.WriteLine("Unknown user exception");
                    }
                    inStream.endEncapsulation();
                }
                else if (line.Equals("s"))
                {
                    obj.ice_invoke("shutdown", Ice.OperationMode.Normal, null, out outParams);
                }
                else if (line.Equals("x"))
                {
                    // Nothing to do.
                }
                else if (line.Equals("?"))
                {
                    menu();
                }
                else
                {
                    Console.Error.WriteLine("unknown command `" + line + "'");
                    menu();
                }
            }
            catch (Ice.LocalException ex)
            {
                Console.Error.WriteLine(ex);
            }
        }while(!line.Equals("x"));

        return(0);
    }
예제 #3
0
    public override bool ice_invoke(byte[] inParams, out byte[] outParams, Ice.Current current)
    {
        outParams = null;

        Ice.Communicator communicator = current.adapter.getCommunicator();

        Ice.InputStream inStream = null;
        if (inParams.Length > 0)
        {
            inStream = new Ice.InputStream(communicator, inParams);
            inStream.startEncapsulation();
        }

        if (current.operation.Equals("printString"))
        {
            string message = inStream.readString();
            inStream.endEncapsulation();
            Console.WriteLine("Printing string `" + message + "'");
            return(true);
        }
        else if (current.operation.Equals("printStringSequence"))
        {
            String[] seq = Demo.StringSeqHelper.read(inStream);
            inStream.endEncapsulation();
            Console.Write("Printing string sequence {");
            for (int i = 0; i < seq.Length; ++i)
            {
                if (i > 0)
                {
                    Console.Write(", ");
                }
                Console.Write("'" + seq[i] + "'");
            }
            Console.WriteLine("}");
            return(true);
        }
        else if (current.operation.Equals("printDictionary"))
        {
            Dictionary <string, string> dict = Demo.StringDictHelper.read(inStream);
            inStream.endEncapsulation();
            Console.Write("Printing dictionary {");
            bool first = true;
            foreach (KeyValuePair <string, string> e in dict)
            {
                if (!first)
                {
                    Console.Write(", ");
                }
                first = false;
                Console.Write(e.Key + "=" + e.Value);
            }
            Console.WriteLine("}");
            return(true);
        }
        else if (current.operation.Equals("printEnum"))
        {
            Demo.Color c = Demo.ColorHelper.read(inStream);
            inStream.endEncapsulation();
            Console.WriteLine("Printing enum " + c);
            return(true);
        }
        else if (current.operation.Equals("printStruct"))
        {
            Demo.Structure s = Demo.Structure.read(inStream);
            inStream.endEncapsulation();
            Console.WriteLine("Printing struct: name=" + s.name + ", value=" + s.value);
            return(true);
        }
        else if (current.operation.Equals("printStructSequence"))
        {
            Demo.Structure[] seq = Demo.StructureSeqHelper.read(inStream);
            inStream.endEncapsulation();
            Console.Write("Printing struct sequence: {");
            for (int i = 0; i < seq.Length; ++i)
            {
                if (i > 0)
                {
                    Console.Write(", ");
                }
                Console.Write(seq[i].name + "=" + seq[i].value);
            }
            Console.WriteLine("}");
            return(true);
        }
        else if (current.operation.Equals("printClass"))
        {
            ReadValueCallback cb = new ReadValueCallback();
            inStream.readValue(cb.invoke);
            inStream.readPendingValues();
            inStream.endEncapsulation();
            Demo.C c = cb.obj as Demo.C;
            Console.WriteLine("Printing class: s.name=" + c.s.name + ", s.value=" + c.s.value);
            return(true);
        }
        else if (current.operation.Equals("getValues"))
        {
            Demo.C c = new Demo.C();
            c.s       = new Demo.Structure();
            c.s.name  = "green";
            c.s.value = Demo.Color.green;
            Ice.OutputStream outStream = new Ice.OutputStream(communicator);
            outStream.startEncapsulation();
            outStream.writeValue(c);
            outStream.writeString("hello");
            outStream.writePendingValues();
            outStream.endEncapsulation();
            outParams = outStream.finished();
            return(true);
        }
        else if (current.operation.Equals("throwPrintFailure"))
        {
            Console.WriteLine("Throwing PrintFailure");
            Demo.PrintFailure ex = new Demo.PrintFailure();
            ex.reason = "paper tray empty";
            Ice.OutputStream outStream = new Ice.OutputStream(communicator);
            outStream.startEncapsulation();
            outStream.writeException(ex);
            outStream.endEncapsulation();
            outParams = outStream.finished();
            return(false);
        }
        else if (current.operation.Equals("shutdown"))
        {
            current.adapter.getCommunicator().shutdown();
            return(true);
        }
        else
        {
            Ice.OperationNotExistException ex = new Ice.OperationNotExistException();
            ex.id        = current.id;
            ex.facet     = current.facet;
            ex.operation = current.operation;
            throw ex;
        }
    }
예제 #4
0
파일: Client.cs 프로젝트: leonvip/ice-demos
        public override int run(string[] args)
        {
            if (args.Length > 0)
            {
                Console.Error.WriteLine(appName() + ": too many arguments");
                return(1);
            }

            Ice.ObjectPrx obj = communicator().propertyToProxy("Printer.Proxy");

            menu();

            string line = null;

            do
            {
                try
                {
                    Console.Write("==> ");
                    Console.Out.Flush();
                    line = Console.In.ReadLine();
                    if (line == null)
                    {
                        break;
                    }

                    byte[] outParams;

                    if (line.Equals("1"))
                    {
                        //
                        // Marshal the in parameter.
                        //
                        Ice.OutputStream outStream = new Ice.OutputStream(communicator());
                        outStream.startEncapsulation();
                        outStream.writeString("The streaming API works!");
                        outStream.endEncapsulation();

                        //
                        // Invoke operation.
                        //
                        if (!obj.ice_invoke("printString", Ice.OperationMode.Normal, outStream.finished(),
                                            out outParams))
                        {
                            Console.Error.WriteLine("Unknown user exception");
                        }
                    }
                    else if (line.Equals("2"))
                    {
                        //
                        // Marshal the in parameter.
                        //
                        Ice.OutputStream outStream = new Ice.OutputStream(communicator());
                        outStream.startEncapsulation();
                        string[] arr = { "The", "streaming", "API", "works!" };
                        Demo.StringSeqHelper.write(outStream, arr);
                        outStream.endEncapsulation();

                        //
                        // Invoke operation.
                        //
                        if (!obj.ice_invoke("printStringSequence", Ice.OperationMode.Normal, outStream.finished(),
                                            out outParams))
                        {
                            Console.Error.WriteLine("Unknown user exception");
                        }
                    }
                    else if (line.Equals("3"))
                    {
                        //
                        // Marshal the in parameter.
                        //
                        Ice.OutputStream outStream = new Ice.OutputStream(communicator());
                        outStream.startEncapsulation();
                        Dictionary <string, string> dict = new Dictionary <string, string>();
                        dict["The"] = "streaming";
                        dict["API"] = "works!";
                        Demo.StringDictHelper.write(outStream, dict);
                        outStream.endEncapsulation();

                        //
                        // Invoke operation.
                        //
                        if (!obj.ice_invoke("printDictionary", Ice.OperationMode.Normal, outStream.finished(),
                                            out outParams))
                        {
                            Console.Error.WriteLine("Unknown user exception");
                        }
                    }
                    else if (line.Equals("4"))
                    {
                        //
                        // Marshal the in parameter.
                        //
                        Ice.OutputStream outStream = new Ice.OutputStream(communicator());
                        outStream.startEncapsulation();
                        Demo.ColorHelper.write(outStream, Demo.Color.green);
                        outStream.endEncapsulation();

                        //
                        // Invoke operation.
                        //
                        if (!obj.ice_invoke("printEnum", Ice.OperationMode.Normal, outStream.finished(), out outParams))
                        {
                            Console.Error.WriteLine("Unknown user exception");
                        }
                    }
                    else if (line.Equals("5"))
                    {
                        //
                        // Marshal the in parameter.
                        //
                        Ice.OutputStream outStream = new Ice.OutputStream(communicator());
                        outStream.startEncapsulation();
                        Demo.Structure s = new Demo.Structure();
                        s.name  = "red";
                        s.value = Demo.Color.red;
                        Demo.Structure.write(outStream, s);
                        outStream.endEncapsulation();

                        //
                        // Invoke operation.
                        //
                        if (!obj.ice_invoke("printStruct", Ice.OperationMode.Normal, outStream.finished(),
                                            out outParams))
                        {
                            Console.Error.WriteLine("Unknown user exception");
                        }
                    }
                    else if (line.Equals("6"))
                    {
                        //
                        // Marshal the in parameter.
                        //
                        Ice.OutputStream outStream = new Ice.OutputStream(communicator());
                        outStream.startEncapsulation();
                        Demo.Structure[] arr = new Demo.Structure[3];
                        arr[0]       = new Demo.Structure();
                        arr[0].name  = "red";
                        arr[0].value = Demo.Color.red;
                        arr[1]       = new Demo.Structure();
                        arr[1].name  = "green";
                        arr[1].value = Demo.Color.green;
                        arr[2]       = new Demo.Structure();
                        arr[2].name  = "blue";
                        arr[2].value = Demo.Color.blue;
                        Demo.StructureSeqHelper.write(outStream, arr);
                        outStream.endEncapsulation();

                        //
                        // Invoke operation.
                        //
                        if (!obj.ice_invoke("printStructSequence", Ice.OperationMode.Normal, outStream.finished(),
                                            out outParams))
                        {
                            Console.Error.WriteLine("Unknown user exception");
                        }
                    }
                    else if (line.Equals("7"))
                    {
                        //
                        // Marshal the in parameter.
                        //
                        Ice.OutputStream outStream = new Ice.OutputStream(communicator());
                        outStream.startEncapsulation();
                        Demo.C c = new Demo.C();
                        c.s       = new Demo.Structure();
                        c.s.name  = "blue";
                        c.s.value = Demo.Color.blue;
                        outStream.writeValue(c);
                        outStream.writePendingValues();
                        outStream.endEncapsulation();

                        //
                        // Invoke operation.
                        //
                        if (!obj.ice_invoke("printClass", Ice.OperationMode.Normal, outStream.finished(), out outParams))
                        {
                            Console.Error.WriteLine("Unknown user exception");
                        }
                    }
                    else if (line.Equals("8"))
                    {
                        //
                        // Invoke operation.
                        //
                        if (!obj.ice_invoke("getValues", Ice.OperationMode.Normal, null, out outParams))
                        {
                            Console.Error.WriteLine("Unknown user exception");
                            continue;
                        }

                        //
                        // Unmarshal the results.
                        //
                        Ice.InputStream inStream = new Ice.InputStream(communicator(), outParams);
                        inStream.startEncapsulation();
                        ReadValueCallback cb = new ReadValueCallback();
                        inStream.readValue(cb.invoke);
                        String str = inStream.readString();
                        inStream.readPendingValues();
                        Demo.C c = cb.obj as Demo.C;
                        Console.Error.WriteLine("Got string `" + str + "' and class: s.name=" + c.s.name +
                                                ", s.value=" + c.s.value);
                    }
                    else if (line.Equals("9"))
                    {
                        //
                        // Invoke operation.
                        //
                        if (obj.ice_invoke("throwPrintFailure", Ice.OperationMode.Normal, null, out outParams))
                        {
                            Console.Error.WriteLine("Expected exception");
                            continue;
                        }

                        Ice.InputStream inStream = new Ice.InputStream(communicator(), outParams);
                        inStream.startEncapsulation();
                        try
                        {
                            inStream.throwException();
                        }
                        catch (Demo.PrintFailure)
                        {
                            // Expected.
                        }
                        catch (Ice.UserException)
                        {
                            Console.Error.WriteLine("Unknown user exception");
                        }
                        inStream.endEncapsulation();
                    }
                    else if (line.Equals("s"))
                    {
                        obj.ice_invoke("shutdown", Ice.OperationMode.Normal, null, out outParams);
                    }
                    else if (line.Equals("x"))
                    {
                        // Nothing to do.
                    }
                    else if (line.Equals("?"))
                    {
                        menu();
                    }
                    else
                    {
                        Console.Error.WriteLine("unknown command `" + line + "'");
                        menu();
                    }
                }
                catch (Ice.LocalException ex)
                {
                    Console.Error.WriteLine(ex);
                }
            }while(!line.Equals("x"));

            return(0);
        }
예제 #5
0
    public override bool ice_invoke(byte[] inParams, out byte[] outParams, Ice.Current current)
    {
        outParams = null;
        bool result = true;

        var communicator = current.adapter.getCommunicator();

        Ice.InputStream inStream = null;
        if (inParams.Length > 0)
        {
            inStream = new Ice.InputStream(communicator, inParams);
            inStream.startEncapsulation();
        }

        if (current.operation.Equals("printString"))
        {
            var message = inStream.readString();
            Console.WriteLine("Printing string `" + message + "'");
        }
        else if (current.operation.Equals("printStringSequence"))
        {
            var seq = StringSeqHelper.read(inStream);
            Console.Write("Printing string sequence {");
            for (int i = 0; i < seq.Length; ++i)
            {
                if (i > 0)
                {
                    Console.Write(", ");
                }
                Console.Write("'" + seq[i] + "'");
            }
            Console.WriteLine("}");
        }
        else if (current.operation.Equals("printDictionary"))
        {
            var dict = StringDictHelper.read(inStream);
            Console.Write("Printing dictionary {");
            bool first = true;
            foreach (var e in dict)
            {
                if (!first)
                {
                    Console.Write(", ");
                }
                first = false;
                Console.Write(e.Key + "=" + e.Value);
            }
            Console.WriteLine("}");
        }
        else if (current.operation.Equals("printEnum"))
        {
            var c = ColorHelper.read(inStream);
            Console.WriteLine("Printing enum " + c);
        }
        else if (current.operation.Equals("printStruct"))
        {
            var s = Structure.ice_read(inStream);
            Console.WriteLine("Printing struct: name=" + s.name + ", value=" + s.value);
        }
        else if (current.operation.Equals("printStructSequence"))
        {
            var seq = StructureSeqHelper.read(inStream);
            Console.Write("Printing struct sequence: {");
            for (int i = 0; i < seq.Length; ++i)
            {
                if (i > 0)
                {
                    Console.Write(", ");
                }
                Console.Write(seq[i].name + "=" + seq[i].value);
            }
            Console.WriteLine("}");
        }
        else if (current.operation.Equals("printClass"))
        {
            var cb = new ReadValueCallback();
            inStream.readValue(cb.invoke);
            inStream.readPendingValues();
            var c = cb.obj as C;
            Console.WriteLine("Printing class: s.name=" + c.s.name + ", s.value=" + c.s.value);
        }
        else if (current.operation.Equals("getValues"))
        {
            var c         = new C(new Structure("green", Color.green));
            var outStream = new Ice.OutputStream(communicator);
            outStream.startEncapsulation();
            outStream.writeValue(c);
            outStream.writeString("hello");
            outStream.writePendingValues();
            outStream.endEncapsulation();
            outParams = outStream.finished();
        }
        else if (current.operation.Equals("throwPrintFailure"))
        {
            Console.WriteLine("Throwing PrintFailure");
            var ex        = new PrintFailure("paper tray empty");
            var outStream = new Ice.OutputStream(communicator);
            outStream.startEncapsulation();
            outStream.writeException(ex);
            outStream.endEncapsulation();
            outParams = outStream.finished();
            result    = false;
        }
        else if (current.operation.Equals("shutdown"))
        {
            current.adapter.getCommunicator().shutdown();
        }
        else
        {
            throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);
        }

        //
        // Make sure we read all in parameters
        //
        inStream.endEncapsulation();
        return(result);
    }
예제 #6
0
    static public int run(Ice.Communicator communicator)
    {
        MyClassFactoryWrapper factoryWrapper = new MyClassFactoryWrapper();

        communicator.getValueFactoryManager().add(factoryWrapper.create, MyClass.ice_staticId());

        Ice.InputStream  inS;
        Ice.OutputStream outS;

        Write("testing primitive types... ");
        Flush();

        {
            byte[] data = new byte[0];
            inS = new Ice.InputStream(communicator, data);
        }

        {
            outS = new Ice.OutputStream(communicator);
            outS.startEncapsulation();
            outS.writeBool(true);
            outS.endEncapsulation();
            var data = outS.finished();

            inS = new Ice.InputStream(communicator, data);
            inS.startEncapsulation();
            test(inS.readBool());
            inS.endEncapsulation();

            inS = new Ice.InputStream(communicator, data);
            inS.startEncapsulation();
            test(inS.readBool());
            inS.endEncapsulation();
        }

        {
            var data = new byte[0];
            inS = new Ice.InputStream(communicator, data);
            try
            {
                inS.readBool();
                test(false);
            }
            catch (Ice.UnmarshalOutOfBoundsException)
            {
            }
        }

        {
            outS = new Ice.OutputStream(communicator);
            outS.writeBool(true);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            test(inS.readBool());
        }

        {
            outS = new Ice.OutputStream(communicator);
            outS.writeByte(1);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            test(inS.readByte() == 1);
        }

        {
            outS = new Ice.OutputStream(communicator);
            outS.writeShort(2);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            test(inS.readShort() == 2);
        }

        {
            outS = new Ice.OutputStream(communicator);
            outS.writeInt(3);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            test(inS.readInt() == 3);
        }

        {
            outS = new Ice.OutputStream(communicator);
            outS.writeLong(4);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            test(inS.readLong() == 4);
        }

        {
            outS = new Ice.OutputStream(communicator);
            outS.writeFloat((float)5.0);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            test(inS.readFloat() == (float)5.0);
        }

        {
            outS = new Ice.OutputStream(communicator);
            outS.writeDouble(6.0);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            test(inS.readDouble() == 6.0);
        }

        {
            outS = new Ice.OutputStream(communicator);
            outS.writeString("hello world");
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            test(inS.readString().Equals("hello world"));
        }

        WriteLine("ok");

        Write("testing constructed types... ");
        Flush();

        {
            outS = new Ice.OutputStream(communicator);
            MyEnumHelper.write(outS, MyEnum.enum3);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var e = MyEnumHelper.read(inS);
            test(e == MyEnum.enum3);
        }

        {
            outS = new Ice.OutputStream(communicator);
            var s = new SmallStruct();
            s.bo  = true;
            s.by  = 1;
            s.sh  = 2;
            s.i   = 3;
            s.l   = 4;
            s.f   = 5.0f;
            s.d   = 6.0;
            s.str = "7";
            s.e   = MyEnum.enum2;
            s.p   = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy("test:default"));
            SmallStruct.write(outS, s);
            var data = outS.finished();
            var s2   = SmallStruct.read(new Ice.InputStream(communicator, data));
            test(s2.Equals(s));
        }

        {
            outS = new Ice.OutputStream(communicator);
            var o = new OptionalClass();
            o.bo = true;
            o.by = 5;
            o.sh = 4;
            o.i  = 3;
            outS.writeValue(o);
            outS.writePendingValues();
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            TestReadValueCallback cb = new TestReadValueCallback();
            inS.readValue(cb.invoke);
            inS.readPendingValues();
            var o2 = (OptionalClass)cb.obj;
            test(o2.bo == o.bo);
            test(o2.by == o.by);
            if (communicator.getProperties().getProperty("Ice.Default.EncodingVersion").Equals("1.0"))
            {
                test(!o2.sh.HasValue);
                test(!o2.i.HasValue);
            }
            else
            {
                test(o2.sh.Value == o.sh.Value);
                test(o2.i.Value == o.i.Value);
            }
        }

        {
            outS = new Ice.OutputStream(communicator, Ice.Util.Encoding_1_0);
            var o = new OptionalClass();
            o.bo = true;
            o.by = 5;
            o.sh = 4;
            o.i  = 3;
            outS.writeValue(o);
            outS.writePendingValues();
            byte[] data = outS.finished();
            inS = new Ice.InputStream(communicator, Ice.Util.Encoding_1_0, data);
            var cb = new TestReadValueCallback();
            inS.readValue(cb.invoke);
            inS.readPendingValues();
            var o2 = (OptionalClass)cb.obj;
            test(o2.bo == o.bo);
            test(o2.by == o.by);
            test(!o2.sh.HasValue);
            test(!o2.i.HasValue);
        }

        {
            bool[] arr = { true, false, true, false };
            outS = new Ice.OutputStream(communicator);
            Ice.BoolSeqHelper.write(outS, arr);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var arr2 = Ice.BoolSeqHelper.read(inS);
            test(Compare(arr2, arr));

            bool[][] arrS = { arr, new bool[0], arr };
            outS = new Ice.OutputStream(communicator);
            BoolSSHelper.write(outS, arrS);
            data = outS.finished();
            inS  = new Ice.InputStream(communicator, data);
            var arr2S = BoolSSHelper.read(inS);
            test(Compare(arr2S, arrS));
        }

        {
            byte[] arr = { 0x01, 0x11, 0x12, 0x22 };
            outS = new Ice.OutputStream(communicator);
            Ice.ByteSeqHelper.write(outS, arr);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var arr2 = Ice.ByteSeqHelper.read(inS);
            test(Compare(arr2, arr));

            byte[][] arrS = { arr, new byte[0], arr };
            outS = new Ice.OutputStream(communicator);
            ByteSSHelper.write(outS, arrS);
            data = outS.finished();
            inS  = new Ice.InputStream(communicator, data);
            var arr2S = ByteSSHelper.read(inS);
            test(Compare(arr2S, arrS));
        }

        {
            Serialize.Small small = new Serialize.Small();
            small.i = 99;
            outS    = new Ice.OutputStream(communicator);
            outS.writeSerializable(small);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var small2 = (Serialize.Small)inS.readSerializable();
            test(small2.i == 99);
        }

        {
            short[] arr = { 0x01, 0x11, 0x12, 0x22 };
            outS = new Ice.OutputStream(communicator);
            Ice.ShortSeqHelper.write(outS, arr);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var arr2 = Ice.ShortSeqHelper.read(inS);
            test(Compare(arr2, arr));

            short[][] arrS = { arr, new short[0], arr };
            outS = new Ice.OutputStream(communicator);
            ShortSSHelper.write(outS, arrS);
            data = outS.finished();
            inS  = new Ice.InputStream(communicator, data);
            var arr2S = ShortSSHelper.read(inS);
            test(Compare(arr2S, arrS));
        }

        {
            int[] arr = { 0x01, 0x11, 0x12, 0x22 };
            outS = new Ice.OutputStream(communicator);
            Ice.IntSeqHelper.write(outS, arr);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var arr2 = Ice.IntSeqHelper.read(inS);
            test(Compare(arr2, arr));

            int[][] arrS = { arr, new int[0], arr };
            outS = new Ice.OutputStream(communicator);
            IntSSHelper.write(outS, arrS);
            data = outS.finished();
            inS  = new Ice.InputStream(communicator, data);
            var arr2S = IntSSHelper.read(inS);
            test(Compare(arr2S, arrS));
        }

        {
            long[] arr = { 0x01, 0x11, 0x12, 0x22 };
            outS = new Ice.OutputStream(communicator);
            Ice.LongSeqHelper.write(outS, arr);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var arr2 = Ice.LongSeqHelper.read(inS);
            test(Compare(arr2, arr));

            long[][] arrS = { arr, new long[0], arr };
            outS = new Ice.OutputStream(communicator);
            LongSSHelper.write(outS, arrS);
            data = outS.finished();
            inS  = new Ice.InputStream(communicator, data);
            var arr2S = LongSSHelper.read(inS);
            test(Compare(arr2S, arrS));
        }

        {
            float[] arr = { 1, 2, 3, 4 };
            outS = new Ice.OutputStream(communicator);
            Ice.FloatSeqHelper.write(outS, arr);
            byte[] data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            float[] arr2 = Ice.FloatSeqHelper.read(inS);
            test(Compare(arr2, arr));

            float[][] arrS = { arr, new float[0], arr };
            outS = new Ice.OutputStream(communicator);
            FloatSSHelper.write(outS, arrS);
            data = outS.finished();
            inS  = new Ice.InputStream(communicator, data);
            var arr2S = FloatSSHelper.read(inS);
            test(Compare(arr2S, arrS));
        }

        {
            double[] arr =
            {
                (double)1,
                (double)2,
                (double)3,
                (double)4
            };
            outS = new Ice.OutputStream(communicator);
            Ice.DoubleSeqHelper.write(outS, arr);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var arr2 = Ice.DoubleSeqHelper.read(inS);
            test(Compare(arr2, arr));

            double[][] arrS = { arr, new double[0], arr };
            outS = new Ice.OutputStream(communicator);
            DoubleSSHelper.write(outS, arrS);
            data = outS.finished();
            inS  = new Ice.InputStream(communicator, data);
            var arr2S = DoubleSSHelper.read(inS);
            test(Compare(arr2S, arrS));
        }

        {
            string[] arr = { "string1", "string2", "string3", "string4" };
            outS = new Ice.OutputStream(communicator);
            Ice.StringSeqHelper.write(outS, arr);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var arr2 = Ice.StringSeqHelper.read(inS);
            test(Compare(arr2, arr));

            string[][] arrS = { arr, new string[0], arr };
            outS = new Ice.OutputStream(communicator);
            StringSSHelper.write(outS, arrS);
            data = outS.finished();
            inS  = new Ice.InputStream(communicator, data);
            var arr2S = StringSSHelper.read(inS);
            test(Compare(arr2S, arrS));
        }

        {
            MyEnum[] arr = { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1, MyEnum.enum2 };
            outS = new Ice.OutputStream(communicator);
            MyEnumSHelper.write(outS, arr);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var arr2 = MyEnumSHelper.read(inS);
            test(Compare(arr2, arr));

            MyEnum[][] arrS = { arr, new MyEnum[0], arr };
            outS = new Ice.OutputStream(communicator);
            MyEnumSSHelper.write(outS, arrS);
            data = outS.finished();
            inS  = new Ice.InputStream(communicator, data);
            var arr2S = MyEnumSSHelper.read(inS);
            test(Compare(arr2S, arrS));
        }

        var smallStructArray = new SmallStruct[3];

        for (int i = 0; i < smallStructArray.Length; ++i)
        {
            smallStructArray[i]     = new SmallStruct();
            smallStructArray[i].bo  = true;
            smallStructArray[i].by  = 1;
            smallStructArray[i].sh  = 2;
            smallStructArray[i].i   = 3;
            smallStructArray[i].l   = 4;
            smallStructArray[i].f   = 5.0f;
            smallStructArray[i].d   = 6.0;
            smallStructArray[i].str = "7";
            smallStructArray[i].e   = MyEnum.enum2;
            smallStructArray[i].p   = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy("test:default"));
        }

        var myClassArray = new MyClass[4];

        for (int i = 0; i < myClassArray.Length; ++i)
        {
            myClassArray[i]         = new MyClass();
            myClassArray[i].c       = myClassArray[i];
            myClassArray[i].o       = myClassArray[i];
            myClassArray[i].s       = new SmallStruct();
            myClassArray[i].s.e     = MyEnum.enum2;
            myClassArray[i].seq1    = new bool[] { true, false, true, false };
            myClassArray[i].seq2    = new byte[] { 1, 2, 3, 4 };
            myClassArray[i].seq3    = new short[] { 1, 2, 3, 4 };
            myClassArray[i].seq4    = new int[] { 1, 2, 3, 4 };
            myClassArray[i].seq5    = new long[] { 1, 2, 3, 4 };
            myClassArray[i].seq6    = new float[] { 1, 2, 3, 4 };
            myClassArray[i].seq7    = new double[] { 1, 2, 3, 4 };
            myClassArray[i].seq8    = new string[] { "string1", "string2", "string3", "string4" };
            myClassArray[i].seq9    = new MyEnum[] { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1 };
            myClassArray[i].seq10   = new MyClass[4]; // null elements.
            myClassArray[i].d       = new Dictionary <string, Test.MyClass>();
            myClassArray[i].d["hi"] = myClassArray[i];
        }

        {
            outS = new Ice.OutputStream(communicator);
            MyClassSHelper.write(outS, myClassArray);
            outS.writePendingValues();
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var arr2 = MyClassSHelper.read(inS);
            inS.readPendingValues();
            test(arr2.Length == myClassArray.Length);
            for (int i = 0; i < arr2.Length; ++i)
            {
                test(arr2[i] != null);
                test(arr2[i].c == arr2[i]);
                test(arr2[i].o == arr2[i]);
                test(arr2[i].s.e == MyEnum.enum2);
                test(Compare(arr2[i].seq1, myClassArray[i].seq1));
                test(Compare(arr2[i].seq2, myClassArray[i].seq2));
                test(Compare(arr2[i].seq3, myClassArray[i].seq3));
                test(Compare(arr2[i].seq4, myClassArray[i].seq4));
                test(Compare(arr2[i].seq5, myClassArray[i].seq5));
                test(Compare(arr2[i].seq6, myClassArray[i].seq6));
                test(Compare(arr2[i].seq7, myClassArray[i].seq7));
                test(Compare(arr2[i].seq8, myClassArray[i].seq8));
                test(Compare(arr2[i].seq9, myClassArray[i].seq9));
                test(arr2[i].d["hi"].Equals(arr2[i]));
            }

            MyClass[][] arrS = { myClassArray, new MyClass[0], myClassArray };
            outS = new Ice.OutputStream(communicator);
            MyClassSSHelper.write(outS, arrS);
            data = outS.finished();
            inS  = new Ice.InputStream(communicator, data);
            var arr2S = MyClassSSHelper.read(inS);
            test(arr2S.Length == arrS.Length);
            test(arr2S[0].Length == arrS[0].Length);
            test(arr2S[1].Length == arrS[1].Length);
            test(arr2S[2].Length == arrS[2].Length);
        }

        {
            outS = new Ice.OutputStream(communicator);
            var obj = new MyClass();
            obj.s   = new SmallStruct();
            obj.s.e = MyEnum.enum2;
            var writer = new TestValueWriter(obj);
            outS.writeValue(writer);
            outS.writePendingValues();
            var data = outS.finished();
            test(writer.called);
            factoryWrapper.setFactory(TestObjectFactory);
            inS = new Ice.InputStream(communicator, data);
            var cb = new TestReadValueCallback();
            inS.readValue(cb.invoke);
            inS.readPendingValues();
            test(cb.obj != null);
            test(cb.obj is TestValueReader);
            var reader = (TestValueReader)cb.obj;
            test(reader.called);
            test(reader.obj != null);
            test(reader.obj.s.e == MyEnum.enum2);
            factoryWrapper.setFactory(null);
        }

        {
            outS = new Ice.OutputStream(communicator);
            var ex = new MyException();

            var c = new MyClass();
            c.c     = c;
            c.o     = c;
            c.s     = new SmallStruct();
            c.s.e   = MyEnum.enum2;
            c.seq1  = new bool[] { true, false, true, false };
            c.seq2  = new byte[] { 1, 2, 3, 4 };
            c.seq3  = new short[] { 1, 2, 3, 4 };
            c.seq4  = new int[] { 1, 2, 3, 4 };
            c.seq5  = new long[] { 1, 2, 3, 4 };
            c.seq6  = new float[] { 1, 2, 3, 4 };
            c.seq7  = new double[] { 1, 2, 3, 4 };
            c.seq8  = new string[] { "string1", "string2", "string3", "string4" };
            c.seq9  = new MyEnum[] { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1 };
            c.seq10 = new MyClass[4]; // null elements.
            c.d     = new Dictionary <string, MyClass>();
            c.d.Add("hi", c);

            ex.c = c;

            outS.writeException(ex);
            var data = outS.finished();

            inS = new Ice.InputStream(communicator, data);
            try
            {
                inS.throwException();
                test(false);
            }
            catch (MyException ex1)
            {
                test(ex1.c.s.e == c.s.e);
                test(Compare(ex1.c.seq1, c.seq1));
                test(Compare(ex1.c.seq2, c.seq2));
                test(Compare(ex1.c.seq3, c.seq3));
                test(Compare(ex1.c.seq4, c.seq4));
                test(Compare(ex1.c.seq5, c.seq5));
                test(Compare(ex1.c.seq6, c.seq6));
                test(Compare(ex1.c.seq7, c.seq7));
                test(Compare(ex1.c.seq8, c.seq8));
                test(Compare(ex1.c.seq9, c.seq9));
            }
            catch (Ice.UserException)
            {
                test(false);
            }
        }

        {
            var dict = new Dictionary <byte, bool>();
            dict.Add(4, true);
            dict.Add(1, false);
            outS = new Ice.OutputStream(communicator);
            ByteBoolDHelper.write(outS, dict);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var dict2 = ByteBoolDHelper.read(inS);
            test(Ice.CollectionComparer.Equals(dict2, dict));
        }

        {
            var dict = new Dictionary <short, int>();
            dict.Add(1, 9);
            dict.Add(4, 8);
            outS = new Ice.OutputStream(communicator);
            ShortIntDHelper.write(outS, dict);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var dict2 = ShortIntDHelper.read(inS);
            test(Ice.CollectionComparer.Equals(dict2, dict));
        }

        {
            var dict = new Dictionary <long, float>();
            dict.Add(123809828, 0.51f);
            dict.Add(123809829, 0.56f);
            outS = new Ice.OutputStream(communicator);
            LongFloatDHelper.write(outS, dict);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var dict2 = LongFloatDHelper.read(inS);
            test(Ice.CollectionComparer.Equals(dict2, dict));
        }

        {
            var dict = new Dictionary <string, string>();
            dict.Add("key1", "value1");
            dict.Add("key2", "value2");
            outS = new Ice.OutputStream(communicator);
            StringStringDHelper.write(outS, dict);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var dict2 = StringStringDHelper.read(inS);
            test(Ice.CollectionComparer.Equals(dict2, dict));
        }

        {
            var dict = new Dictionary <string, MyClass>();
            var c    = new MyClass();
            c.s   = new SmallStruct();
            c.s.e = MyEnum.enum2;
            dict.Add("key1", c);
            c     = new MyClass();
            c.s   = new SmallStruct();
            c.s.e = MyEnum.enum3;
            dict.Add("key2", c);
            outS = new Ice.OutputStream(communicator);
            StringMyClassDHelper.write(outS, dict);
            outS.writePendingValues();
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var dict2 = StringMyClassDHelper.read(inS);
            inS.readPendingValues();
            test(dict2.Count == dict.Count);
            test(dict2["key1"].s.e == MyEnum.enum2);
            test(dict2["key2"].s.e == MyEnum.enum3);
        }

        {
            bool[] arr = { true, false, true, false };
            outS = new Ice.OutputStream(communicator);
            var l = new List <bool>(arr);
            BoolListHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = BoolListHelper.read(inS);
            test(Compare(l, l2));
        }

        {
            byte[] arr = { 0x01, 0x11, 0x12, 0x22 };
            outS = new Ice.OutputStream(communicator);
            var l = new List <byte>(arr);
            ByteListHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = ByteListHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            MyEnum[] arr = { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1, MyEnum.enum2 };
            outS = new Ice.OutputStream(communicator);
            var l = new List <MyEnum>(arr);
            MyEnumListHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = MyEnumListHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            outS = new Ice.OutputStream(communicator);
            var l = new List <SmallStruct>(smallStructArray);
            SmallStructListHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = SmallStructListHelper.read(inS);
            test(l2.Count == l.Count);
            for (int i = 0; i < l2.Count; ++i)
            {
                test(l2[i].Equals(smallStructArray[i]));
            }
        }

        {
            outS = new Ice.OutputStream(communicator);
            var l = new List <MyClass>(myClassArray);
            MyClassListHelper.write(outS, l);
            outS.writePendingValues();
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = MyClassListHelper.read(inS);
            inS.readPendingValues();
            test(l2.Count == l.Count);
            for (int i = 0; i < l2.Count; ++i)
            {
                test(l2[i] != null);
                test(l2[i].c == l2[i]);
                test(l2[i].o == l2[i]);
                test(l2[i].s.e == MyEnum.enum2);
                test(Compare(l2[i].seq1, l[i].seq1));
                test(Compare(l2[i].seq2, l[i].seq2));
                test(Compare(l2[i].seq3, l[i].seq3));
                test(Compare(l2[i].seq4, l[i].seq4));
                test(Compare(l2[i].seq5, l[i].seq5));
                test(Compare(l2[i].seq6, l[i].seq6));
                test(Compare(l2[i].seq7, l[i].seq7));
                test(Compare(l2[i].seq8, l[i].seq8));
                test(Compare(l2[i].seq9, l[i].seq9));
                test(l2[i].d["hi"].Equals(l2[i]));
            }
        }

        {
            var arr = new MyClassPrx[2];
            arr[0] = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy("zero"));
            arr[1] = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy("one"));
            outS   = new Ice.OutputStream(communicator);
            var l = new List <MyClassPrx>(arr);
            MyClassProxyListHelper.write(outS, l);
            byte[] data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = MyClassProxyListHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            short[] arr = { 0x01, 0x11, 0x12, 0x22 };
            outS = new Ice.OutputStream(communicator);
            var l = new LinkedList <short>(arr);
            ShortLinkedListHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = ShortLinkedListHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            int[] arr = { 0x01, 0x11, 0x12, 0x22 };
            outS = new Ice.OutputStream(communicator);
            LinkedList <int> l = new LinkedList <int>(arr);
            Test.IntLinkedListHelper.write(outS, l);
            byte[] data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            LinkedList <int> l2 = Test.IntLinkedListHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            MyEnum[] arr = { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1, MyEnum.enum2 };
            outS = new Ice.OutputStream(communicator);
            LinkedList <Test.MyEnum> l = new LinkedList <Test.MyEnum>(arr);
            Test.MyEnumLinkedListHelper.write(outS, l);
            byte[] data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            LinkedList <Test.MyEnum> l2 = Test.MyEnumLinkedListHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            outS = new Ice.OutputStream(communicator);
            var l = new LinkedList <Test.SmallStruct>(smallStructArray);
            SmallStructLinkedListHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = SmallStructLinkedListHelper.read(inS);
            test(l2.Count == l.Count);
            var e  = l.GetEnumerator();
            var e2 = l2.GetEnumerator();
            while (e.MoveNext() && e2.MoveNext())
            {
                test(e.Current.Equals(e2.Current));
            }
        }

        {
            long[] arr = { 0x01, 0x11, 0x12, 0x22 };
            outS = new Ice.OutputStream(communicator);
            var l = new Stack <long>(arr);
            LongStackHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = LongStackHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            float[] arr = { 1, 2, 3, 4 };
            outS = new Ice.OutputStream(communicator);
            var l = new Stack <float>(arr);
            FloatStackHelper.write(outS, l);
            byte[] data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = FloatStackHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            outS = new Ice.OutputStream(communicator);
            var l = new Stack <SmallStruct>(smallStructArray);
            SmallStructStackHelper.write(outS, l);
            byte[] data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = SmallStructStackHelper.read(inS);
            test(l2.Count == l.Count);
            var e  = l.GetEnumerator();
            var e2 = l2.GetEnumerator();
            while (e.MoveNext() && e2.MoveNext())
            {
                test(e.Current.Equals(e2.Current));
            }
        }

        {
            var arr = new MyClassPrx[2];
            arr[0] = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy("zero"));
            arr[1] = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy("one"));
            outS   = new Ice.OutputStream(communicator);
            var l = new Stack <MyClassPrx>(arr);
            MyClassProxyStackHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = MyClassProxyStackHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            double[] arr = { 1, 2, 3, 4 };
            outS = new Ice.OutputStream(communicator);
            var l = new Queue <double>(arr);
            DoubleQueueHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = DoubleQueueHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            string[] arr = { "string1", "string2", "string3", "string4" };
            outS = new Ice.OutputStream(communicator);
            var l = new Queue <string>(arr);
            StringQueueHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = StringQueueHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            outS = new Ice.OutputStream(communicator);
            var l = new Queue <SmallStruct>(smallStructArray);
            SmallStructQueueHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = SmallStructQueueHelper.read(inS);
            test(l2.Count == l.Count);
            var e  = l.GetEnumerator();
            var e2 = l2.GetEnumerator();
            while (e.MoveNext() && e2.MoveNext())
            {
                test(e.Current.Equals(e2.Current));
            }
        }

        {
            string[]   arr  = { "string1", "string2", "string3", "string4" };
            string[][] arrS = { arr, new string[0], arr };
            outS = new Ice.OutputStream(communicator);
            var l = new List <string[]>(arrS);
            StringSListHelper.write(outS, l);
            byte[] data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = StringSListHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            string[]   arr  = { "string1", "string2", "string3", "string4" };
            string[][] arrS = { arr, new string[0], arr };
            outS = new Ice.OutputStream(communicator);
            var l = new Stack <string[]>(arrS);
            StringSStackHelper.write(outS, l);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var l2 = StringSStackHelper.read(inS);
            test(Compare(l2, l));
        }

        {
            var dict = new SortedDictionary <string, string>();
            dict.Add("key1", "value1");
            dict.Add("key2", "value2");
            outS = new Ice.OutputStream(communicator);
            SortedStringStringDHelper.write(outS, dict);
            var data = outS.finished();
            inS = new Ice.InputStream(communicator, data);
            var dict2 = SortedStringStringDHelper.read(inS);
            test(Ice.CollectionComparer.Equals(dict2, dict));
        }

        WriteLine("ok");
        return(0);
    }