package krpc.client.services;

import com.google.protobuf.ByteString;

import krpc.client.Connection;
import krpc.client.Encoder;
import krpc.client.RemoteEnum;
import krpc.client.RemoteObject;
import krpc.client.RPCInfo;
import krpc.client.RPCException;
import krpc.client.Types;

// Generated code references its own deprecated members (e.g. when registering
// exception types), so suppress the deprecation warnings within this class.
@SuppressWarnings("deprecation")
public class TestService {

    public static TestService newInstance(Connection connection) {
        return new TestService(connection);
    }

    private Connection connection;

    private TestService(Connection connection) {
        this.connection = connection;
        addExceptionTypes(connection);
    }

    public static class CustomException extends krpc.client.RPCException {
        private static final long serialVersionUID = 653216682626171239L;

        public CustomException(String message) {
            super(message);
        }

        public CustomException(String message, Exception innerException) {
            super(message, innerException);
        }
    }

    /**
     * Deprecated exception documentation string.
     *
     * @deprecated Use CustomException instead.
     */
    @Deprecated
    public static class DeprecatedException extends krpc.client.RPCException {
        private static final long serialVersionUID = 483570852596919585L;

        public DeprecatedException(String message) {
            super(message);
        }

        public DeprecatedException(String message, Exception innerException) {
            super(message, innerException);
        }
    }

    private void addExceptionTypes(Connection connection) {
        connection.addExceptionType("TestService", "CustomException", CustomException.class);
        connection.addExceptionType("TestService", "DeprecatedException", DeprecatedException.class);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "AddMultipleValues", types = _Types.class)
    public String addMultipleValues(float x, int y, long z) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(x, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.FLOAT)),
            Encoder.encode(y, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)),
            Encoder.encode(z, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT64))
        };
        ByteString _data = this.connection.invoke("TestService", "AddMultipleValues", _args);
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "AddToObjectList", types = _Types.class)
    public java.util.List<krpc.client.services.TestService.TestClass> addToObjectList(java.util.List<krpc.client.services.TestService.TestClass> l, String value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(l, krpc.client.Types.createList(krpc.client.Types.createClass("TestService", "TestClass"))),
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING))
        };
        ByteString _data = this.connection.invoke("TestService", "AddToObjectList", _args);
        return (java.util.List<krpc.client.services.TestService.TestClass>) Encoder.decode(_data, krpc.client.Types.createList(krpc.client.Types.createClass("TestService", "TestClass")), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "BlockingProcedure", types = _Types.class)
    public int blockingProcedure(int n, int sum) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(n, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)),
            Encoder.encode(sum, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32))
        };
        ByteString _data = this.connection.invoke("TestService", "BlockingProcedure", _args);
        return (int) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "BoolToString", types = _Types.class)
    public String boolToString(boolean value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BOOL))
        };
        ByteString _data = this.connection.invoke("TestService", "BoolToString", _args);
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "BytesToHexString", types = _Types.class)
    public String bytesToHexString(byte[] value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BYTES))
        };
        ByteString _data = this.connection.invoke("TestService", "BytesToHexString", _args);
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "Counter", types = _Types.class)
    public int counter(String id, int divisor) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(id, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING)),
            Encoder.encode(divisor, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32))
        };
        ByteString _data = this.connection.invoke("TestService", "Counter", _args);
        return (int) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "CreateTestObject", types = _Types.class)
    public krpc.client.services.TestService.TestClass createTestObject(String value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING))
        };
        ByteString _data = this.connection.invoke("TestService", "CreateTestObject", _args);
        return (krpc.client.services.TestService.TestClass) Encoder.decode(_data, krpc.client.Types.createClass("TestService", "TestClass"), this.connection);
    }

    /**
     * Deprecated procedure documentation string.
     *
     * @deprecated Use floatToString instead.
     */
    @Deprecated
    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "DeprecatedProcedure", types = _Types.class)
    public String deprecatedProcedure(float value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.FLOAT))
        };
        ByteString _data = this.connection.invoke("TestService", "DeprecatedProcedure", _args);
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    /**
     * Deprecated procedure with no reason documentation string.
     */
    @Deprecated
    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "DeprecatedProcedureNoMessage", types = _Types.class)
    public String deprecatedProcedureNoMessage(float value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.FLOAT))
        };
        ByteString _data = this.connection.invoke("TestService", "DeprecatedProcedureNoMessage", _args);
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "DictionaryDefault", types = _Types.class)
    public java.util.Map<Integer,Boolean> dictionaryDefault(java.util.Map<Integer,Boolean> x) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(x, krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BOOL)))
        };
        ByteString _data = this.connection.invoke("TestService", "DictionaryDefault", _args);
        return (java.util.Map<Integer,Boolean>) Encoder.decode(_data, krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BOOL)), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "DoubleToString", types = _Types.class)
    public String doubleToString(double value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.DOUBLE))
        };
        ByteString _data = this.connection.invoke("TestService", "DoubleToString", _args);
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "EchoTestObject", types = _Types.class)
    public krpc.client.services.TestService.TestClass echoTestObject(krpc.client.services.TestService.TestClass value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createClass("TestService", "TestClass"))
        };
        ByteString _data = this.connection.invoke("TestService", "EchoTestObject", _args);
        return (krpc.client.services.TestService.TestClass) Encoder.decode(_data, krpc.client.Types.createClass("TestService", "TestClass"), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "EnumDefaultArg", types = _Types.class)
    public krpc.client.services.TestService.TestEnum enumDefaultArg(krpc.client.services.TestService.TestEnum x) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(x, krpc.client.Types.createEnumeration("TestService", "TestEnum"))
        };
        ByteString _data = this.connection.invoke("TestService", "EnumDefaultArg", _args);
        return (krpc.client.services.TestService.TestEnum) Encoder.decode(_data, krpc.client.Types.createEnumeration("TestService", "TestEnum"), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "EnumEcho", types = _Types.class)
    public krpc.client.services.TestService.TestEnum enumEcho(krpc.client.services.TestService.TestEnum x) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(x, krpc.client.Types.createEnumeration("TestService", "TestEnum"))
        };
        ByteString _data = this.connection.invoke("TestService", "EnumEcho", _args);
        return (krpc.client.services.TestService.TestEnum) Encoder.decode(_data, krpc.client.Types.createEnumeration("TestService", "TestEnum"), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "EnumReturn", types = _Types.class)
    public krpc.client.services.TestService.TestEnum enumReturn() throws RPCException {
        ByteString _data = this.connection.invoke("TestService", "EnumReturn");
        return (krpc.client.services.TestService.TestEnum) Encoder.decode(_data, krpc.client.Types.createEnumeration("TestService", "TestEnum"), this.connection);
    }

    /**
     * Procedure documentation string.
     */
    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "FloatToString", types = _Types.class)
    public String floatToString(float value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.FLOAT))
        };
        ByteString _data = this.connection.invoke("TestService", "FloatToString", _args);
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "IncrementDictionary", types = _Types.class)
    public java.util.Map<String,Integer> incrementDictionary(java.util.Map<String,Integer> d) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(d, krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)))
        };
        ByteString _data = this.connection.invoke("TestService", "IncrementDictionary", _args);
        return (java.util.Map<String,Integer>) Encoder.decode(_data, krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "IncrementList", types = _Types.class)
    public java.util.List<Integer> incrementList(java.util.List<Integer> l) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(l, krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)))
        };
        ByteString _data = this.connection.invoke("TestService", "IncrementList", _args);
        return (java.util.List<Integer>) Encoder.decode(_data, krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "IncrementNestedCollection", types = _Types.class)
    public java.util.Map<String,java.util.List<Integer>> incrementNestedCollection(java.util.Map<String,java.util.List<Integer>> d) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(d, krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32))))
        };
        ByteString _data = this.connection.invoke("TestService", "IncrementNestedCollection", _args);
        return (java.util.Map<String,java.util.List<Integer>>) Encoder.decode(_data, krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32))), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "IncrementSet", types = _Types.class)
    public java.util.Set<Integer> incrementSet(java.util.Set<Integer> h) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(h, krpc.client.Types.createSet(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)))
        };
        ByteString _data = this.connection.invoke("TestService", "IncrementSet", _args);
        return (java.util.Set<Integer>) Encoder.decode(_data, krpc.client.Types.createSet(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "IncrementTuple", types = _Types.class)
    public org.javatuples.Pair<Integer,Long> incrementTuple(org.javatuples.Pair<Integer,Long> t) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(t, krpc.client.Types.createTuple(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32),krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT64)))
        };
        ByteString _data = this.connection.invoke("TestService", "IncrementTuple", _args);
        return (org.javatuples.Pair<Integer,Long>) Encoder.decode(_data, krpc.client.Types.createTuple(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32),krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT64)), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "Int32ToString", types = _Types.class)
    public String int32ToString(int value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32))
        };
        ByteString _data = this.connection.invoke("TestService", "Int32ToString", _args);
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "Int64ToString", types = _Types.class)
    public String int64ToString(long value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT64))
        };
        ByteString _data = this.connection.invoke("TestService", "Int64ToString", _args);
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "ListDefault", types = _Types.class)
    public java.util.List<Integer> listDefault(java.util.List<Integer> x) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(x, krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)))
        };
        ByteString _data = this.connection.invoke("TestService", "ListDefault", _args);
        return (java.util.List<Integer>) Encoder.decode(_data, krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "OnTimer", types = _Types.class)
    public krpc.client.Event onTimer(int milliseconds, int repeats) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(milliseconds, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.UINT32)),
            Encoder.encode(repeats, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.UINT32))
        };
        ByteString _data = this.connection.invoke("TestService", "OnTimer", _args);
        return (krpc.client.Event) Encoder.decode(_data, krpc.client.Types.createMessage(krpc.schema.KRPC.Type.TypeCode.EVENT), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "OnTimerUsingLambda", types = _Types.class)
    public krpc.client.Event onTimerUsingLambda(int milliseconds) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(milliseconds, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.UINT32))
        };
        ByteString _data = this.connection.invoke("TestService", "OnTimerUsingLambda", _args);
        return (krpc.client.Event) Encoder.decode(_data, krpc.client.Types.createMessage(krpc.schema.KRPC.Type.TypeCode.EVENT), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "OptionalArguments", types = _Types.class)
    public String optionalArguments(String x, String y, String z, krpc.client.services.TestService.TestClass obj) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(x, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING)),
            Encoder.encode(y, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING)),
            Encoder.encode(z, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING)),
            Encoder.encode(obj, krpc.client.Types.createClass("TestService", "TestClass"))
        };
        ByteString _data = this.connection.invoke("TestService", "OptionalArguments", _args);
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "ResetCustomExceptionLater", types = _Types.class)
    public void resetCustomExceptionLater() throws RPCException {
        this.connection.invoke("TestService", "ResetCustomExceptionLater");
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "ResetInvalidOperationExceptionLater", types = _Types.class)
    public void resetInvalidOperationExceptionLater() throws RPCException {
        this.connection.invoke("TestService", "ResetInvalidOperationExceptionLater");
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "ReturnNullWhenNotAllowed", types = _Types.class)
    public krpc.client.services.TestService.TestClass returnNullWhenNotAllowed() throws RPCException {
        ByteString _data = this.connection.invoke("TestService", "ReturnNullWhenNotAllowed");
        return (krpc.client.services.TestService.TestClass) Encoder.decode(_data, krpc.client.Types.createClass("TestService", "TestClass"), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "SetDefault", types = _Types.class)
    public java.util.Set<Integer> setDefault(java.util.Set<Integer> x) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(x, krpc.client.Types.createSet(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)))
        };
        ByteString _data = this.connection.invoke("TestService", "SetDefault", _args);
        return (java.util.Set<Integer>) Encoder.decode(_data, krpc.client.Types.createSet(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "StringToInt32", types = _Types.class)
    public int stringToInt32(String value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING))
        };
        ByteString _data = this.connection.invoke("TestService", "StringToInt32", _args);
        return (int) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "ThrowArgumentException", types = _Types.class)
    public int throwArgumentException() throws RPCException {
        ByteString _data = this.connection.invoke("TestService", "ThrowArgumentException");
        return (int) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "ThrowArgumentNullException", types = _Types.class)
    public int throwArgumentNullException(String foo) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(foo, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING))
        };
        ByteString _data = this.connection.invoke("TestService", "ThrowArgumentNullException", _args);
        return (int) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "ThrowArgumentOutOfRangeException", types = _Types.class)
    public int throwArgumentOutOfRangeException(int foo) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(foo, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32))
        };
        ByteString _data = this.connection.invoke("TestService", "ThrowArgumentOutOfRangeException", _args);
        return (int) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "ThrowCustomException", types = _Types.class)
    public int throwCustomException() throws RPCException {
        ByteString _data = this.connection.invoke("TestService", "ThrowCustomException");
        return (int) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "ThrowCustomExceptionLater", types = _Types.class)
    public int throwCustomExceptionLater() throws RPCException {
        ByteString _data = this.connection.invoke("TestService", "ThrowCustomExceptionLater");
        return (int) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "ThrowInvalidOperationException", types = _Types.class)
    public int throwInvalidOperationException() throws RPCException {
        ByteString _data = this.connection.invoke("TestService", "ThrowInvalidOperationException");
        return (int) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "ThrowInvalidOperationExceptionLater", types = _Types.class)
    public int throwInvalidOperationExceptionLater() throws RPCException {
        ByteString _data = this.connection.invoke("TestService", "ThrowInvalidOperationExceptionLater");
        return (int) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "TupleDefault", types = _Types.class)
    public org.javatuples.Pair<Integer,Boolean> tupleDefault(org.javatuples.Pair<Integer,Boolean> x) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(x, krpc.client.Types.createTuple(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32),krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BOOL)))
        };
        ByteString _data = this.connection.invoke("TestService", "TupleDefault", _args);
        return (org.javatuples.Pair<Integer,Boolean>) Encoder.decode(_data, krpc.client.Types.createTuple(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32),krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BOOL)), this.connection);
    }

    /**
     * Deprecated property documentation string.
     *
     * @deprecated Use stringProperty instead.
     */
    @Deprecated
    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "get_DeprecatedProperty", types = _Types.class)
    public String getDeprecatedProperty() throws RPCException {
        ByteString _data = this.connection.invoke("TestService", "get_DeprecatedProperty");
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    /**
     * Deprecated property documentation string.
     *
     * @deprecated Use stringProperty instead.
     */
    @Deprecated
    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "set_DeprecatedProperty", types = _Types.class)
    public void setDeprecatedProperty(String value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING))
        };
        this.connection.invoke("TestService", "set_DeprecatedProperty", _args);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "get_ObjectProperty", types = _Types.class)
    public krpc.client.services.TestService.TestClass getObjectProperty() throws RPCException {
        ByteString _data = this.connection.invoke("TestService", "get_ObjectProperty");
        return (krpc.client.services.TestService.TestClass) Encoder.decode(_data, krpc.client.Types.createClass("TestService", "TestClass"), this.connection);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "set_ObjectProperty", types = _Types.class)
    public void setObjectProperty(krpc.client.services.TestService.TestClass value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createClass("TestService", "TestClass"))
        };
        this.connection.invoke("TestService", "set_ObjectProperty", _args);
    }

    /**
     * Property documentation string.
     */
    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "get_StringProperty", types = _Types.class)
    public String getStringProperty() throws RPCException {
        ByteString _data = this.connection.invoke("TestService", "get_StringProperty");
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    /**
     * Property documentation string.
     */
    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "set_StringProperty", types = _Types.class)
    public void setStringProperty(String value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING))
        };
        this.connection.invoke("TestService", "set_StringProperty", _args);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "set_StringPropertyPrivateGet", types = _Types.class)
    public void setStringPropertyPrivateGet(String value) throws RPCException {
        ByteString[] _args = new ByteString[] {
            Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING))
        };
        this.connection.invoke("TestService", "set_StringPropertyPrivateGet", _args);
    }

    @SuppressWarnings({ "unchecked" })
    @RPCInfo(service = "TestService", procedure = "get_StringPropertyPrivateSet", types = _Types.class)
    public String getStringPropertyPrivateSet() throws RPCException {
        ByteString _data = this.connection.invoke("TestService", "get_StringPropertyPrivateSet");
        return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
    }

    /**
     * Deprecated enum documentation string.
     *
     * @deprecated Use TestEnum instead.
     */
    @Deprecated
    public enum DeprecatedEnum implements RemoteEnum {
        /**
         * Deprecated enum ValueA documentation string.
         */
        VALUE_A(0),

        /**
         * Deprecated enum ValueB documentation string.
         *
         * @deprecated Use DeprecatedEnum.valueA instead.
         */
        @Deprecated
        VALUE_B(1);

        private final int value;

        private DeprecatedEnum (int value) {
            this.value = value;
        }

        @Override
        public int getValue() {
            return value;
        }

        public static DeprecatedEnum fromValue(int value) {
            switch (value) {
            case 0:
                 return VALUE_A;
            case 1:
                 return VALUE_B;
            }
            return null;
        }
    }

    /**
     * Enum documentation string.
     */
    public enum TestEnum implements RemoteEnum {
        /**
         * Enum ValueA documentation string.
         */
        VALUE_A(0),

        /**
         * Enum ValueB documentation string.
         */
        VALUE_B(1),

        /**
         * Enum ValueC documentation string.
         */
        VALUE_C(2);

        private final int value;

        private TestEnum (int value) {
            this.value = value;
        }

        @Override
        public int getValue() {
            return value;
        }

        public static TestEnum fromValue(int value) {
            switch (value) {
            case 0:
                 return VALUE_A;
            case 1:
                 return VALUE_B;
            case 2:
                 return VALUE_C;
            }
            return null;
        }
    }

    /**
     * Deprecated class documentation string.
     *
     * @deprecated Use TestClass instead.
     */
    @Deprecated
    public static class DeprecatedClass extends RemoteObject {

        private static final long serialVersionUID = 17653684528050254L;

        public DeprecatedClass(Connection connection, long id) {
            super(connection, id);
        }

        /**
         * Deprecated method documentation string.
         *
         * @deprecated Use TestClass.getValue instead.
         */
        @Deprecated
        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "DeprecatedClass_DeprecatedMethod", types = _Types.class)
        public String deprecatedMethod() throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(this, krpc.client.Types.createClass("TestService", "DeprecatedClass"))
            };
            ByteString _data = this.connection.invoke("TestService", "DeprecatedClass_DeprecatedMethod", _args);
            return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
        }
    }

    /**
     * Class documentation string.
     */
    public static class TestClass extends RemoteObject {

        private static final long serialVersionUID = 636122307493780328L;

        public TestClass(Connection connection, long id) {
            super(connection, id);
        }

        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "TestClass_FloatToString", types = _Types.class)
        public String floatToString(float x) throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(this, krpc.client.Types.createClass("TestService", "TestClass")),
                Encoder.encode(x, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.FLOAT))
            };
            ByteString _data = this.connection.invoke("TestService", "TestClass_FloatToString", _args);
            return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
        }

        /**
         * Method documentation string.
         */
        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "TestClass_GetValue", types = _Types.class)
        public String getValue() throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(this, krpc.client.Types.createClass("TestService", "TestClass"))
            };
            ByteString _data = this.connection.invoke("TestService", "TestClass_GetValue", _args);
            return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
        }

        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "TestClass_ObjectToString", types = _Types.class)
        public String objectToString(krpc.client.services.TestService.TestClass other) throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(this, krpc.client.Types.createClass("TestService", "TestClass")),
                Encoder.encode(other, krpc.client.Types.createClass("TestService", "TestClass"))
            };
            ByteString _data = this.connection.invoke("TestService", "TestClass_ObjectToString", _args);
            return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
        }

        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "TestClass_OptionalArguments", types = _Types.class)
        public String optionalArguments(String x, String y, String z, krpc.client.services.TestService.TestClass obj) throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(this, krpc.client.Types.createClass("TestService", "TestClass")),
                Encoder.encode(x, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING)),
                Encoder.encode(y, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING)),
                Encoder.encode(z, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING)),
                Encoder.encode(obj, krpc.client.Types.createClass("TestService", "TestClass"))
            };
            ByteString _data = this.connection.invoke("TestService", "TestClass_OptionalArguments", _args);
            return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
        }

        /**
         * Property documentation string.
         */
        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "TestClass_get_IntProperty", types = _Types.class)
        public int getIntProperty() throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(this, krpc.client.Types.createClass("TestService", "TestClass"))
            };
            ByteString _data = this.connection.invoke("TestService", "TestClass_get_IntProperty", _args);
            return (int) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), this.connection);
        }

        /**
         * Property documentation string.
         */
        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "TestClass_set_IntProperty", types = _Types.class)
        public void setIntProperty(int value) throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(this, krpc.client.Types.createClass("TestService", "TestClass")),
                Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32))
            };
            this.connection.invoke("TestService", "TestClass_set_IntProperty", _args);
        }

        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "TestClass_get_ObjectProperty", types = _Types.class)
        public krpc.client.services.TestService.TestClass getObjectProperty() throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(this, krpc.client.Types.createClass("TestService", "TestClass"))
            };
            ByteString _data = this.connection.invoke("TestService", "TestClass_get_ObjectProperty", _args);
            return (krpc.client.services.TestService.TestClass) Encoder.decode(_data, krpc.client.Types.createClass("TestService", "TestClass"), this.connection);
        }

        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "TestClass_set_ObjectProperty", types = _Types.class)
        public void setObjectProperty(krpc.client.services.TestService.TestClass value) throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(this, krpc.client.Types.createClass("TestService", "TestClass")),
                Encoder.encode(value, krpc.client.Types.createClass("TestService", "TestClass"))
            };
            this.connection.invoke("TestService", "TestClass_set_ObjectProperty", _args);
        }

        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "TestClass_set_StringPropertyPrivateGet", types = _Types.class)
        public void setStringPropertyPrivateGet(String value) throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(this, krpc.client.Types.createClass("TestService", "TestClass")),
                Encoder.encode(value, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING))
            };
            this.connection.invoke("TestService", "TestClass_set_StringPropertyPrivateGet", _args);
        }

        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "TestClass_get_StringPropertyPrivateSet", types = _Types.class)
        public String getStringPropertyPrivateSet() throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(this, krpc.client.Types.createClass("TestService", "TestClass"))
            };
            ByteString _data = this.connection.invoke("TestService", "TestClass_get_StringPropertyPrivateSet", _args);
            return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), this.connection);
        }

        @SuppressWarnings({ "unchecked" })
        @RPCInfo(service = "TestService", procedure = "TestClass_static_StaticMethod", types = _Types.class)
        public static String staticMethod(Connection connection, String a, String b) throws RPCException
        {
            ByteString[] _args = new ByteString[] {
                Encoder.encode(a, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING)),
                Encoder.encode(b, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING))
            };
            ByteString _data = connection.invoke("TestService", "TestClass_static_StaticMethod", _args);
            return (String) Encoder.decode(_data, krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), connection);
        }
    }

    public static class _Types {
        // Procedure return and parameter types are held in lookup maps that are
        // populated by chunked initializer methods. Emitting them this way keeps
        // every generated method under the JVM's 64KB bytecode limit as a service
        // accumulates procedures.
        private static final java.util.Map<String, krpc.schema.KRPC.Type> RETURN_TYPES =
            new java.util.HashMap<String, krpc.schema.KRPC.Type>();
        private static final java.util.Map<String, krpc.schema.KRPC.Type[]> PARAMETER_TYPES =
            new java.util.HashMap<String, krpc.schema.KRPC.Type[]>();

        static {
            initTypes0();
            initTypes1();
        }

        private static void initTypes0() {
            RETURN_TYPES.put("AddMultipleValues", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("AddMultipleValues", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.FLOAT), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT64) });
            RETURN_TYPES.put("AddToObjectList", krpc.client.Types.createList(krpc.client.Types.createClass("TestService", "TestClass")));
            PARAMETER_TYPES.put("AddToObjectList", new krpc.schema.KRPC.Type[] { krpc.client.Types.createList(krpc.client.Types.createClass("TestService", "TestClass")), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING) });
            RETURN_TYPES.put("BlockingProcedure", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32));
            PARAMETER_TYPES.put("BlockingProcedure", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32) });
            RETURN_TYPES.put("BoolToString", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("BoolToString", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BOOL) });
            RETURN_TYPES.put("BytesToHexString", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("BytesToHexString", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BYTES) });
            RETURN_TYPES.put("Counter", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32));
            PARAMETER_TYPES.put("Counter", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32) });
            RETURN_TYPES.put("CreateTestObject", krpc.client.Types.createClass("TestService", "TestClass"));
            PARAMETER_TYPES.put("CreateTestObject", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING) });
            RETURN_TYPES.put("DeprecatedProcedure", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("DeprecatedProcedure", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.FLOAT) });
            RETURN_TYPES.put("DeprecatedProcedureNoMessage", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("DeprecatedProcedureNoMessage", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.FLOAT) });
            RETURN_TYPES.put("DictionaryDefault", krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BOOL)));
            PARAMETER_TYPES.put("DictionaryDefault", new krpc.schema.KRPC.Type[] { krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BOOL)) });
            RETURN_TYPES.put("DoubleToString", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("DoubleToString", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.DOUBLE) });
            RETURN_TYPES.put("EchoTestObject", krpc.client.Types.createClass("TestService", "TestClass"));
            PARAMETER_TYPES.put("EchoTestObject", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass") });
            RETURN_TYPES.put("EnumDefaultArg", krpc.client.Types.createEnumeration("TestService", "TestEnum"));
            PARAMETER_TYPES.put("EnumDefaultArg", new krpc.schema.KRPC.Type[] { krpc.client.Types.createEnumeration("TestService", "TestEnum") });
            RETURN_TYPES.put("EnumEcho", krpc.client.Types.createEnumeration("TestService", "TestEnum"));
            PARAMETER_TYPES.put("EnumEcho", new krpc.schema.KRPC.Type[] { krpc.client.Types.createEnumeration("TestService", "TestEnum") });
            RETURN_TYPES.put("EnumReturn", krpc.client.Types.createEnumeration("TestService", "TestEnum"));
            PARAMETER_TYPES.put("EnumReturn", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("FloatToString", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("FloatToString", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.FLOAT) });
            RETURN_TYPES.put("IncrementDictionary", krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)));
            PARAMETER_TYPES.put("IncrementDictionary", new krpc.schema.KRPC.Type[] { krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)) });
            RETURN_TYPES.put("IncrementList", krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)));
            PARAMETER_TYPES.put("IncrementList", new krpc.schema.KRPC.Type[] { krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)) });
            RETURN_TYPES.put("IncrementNestedCollection", krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32))));
            PARAMETER_TYPES.put("IncrementNestedCollection", new krpc.schema.KRPC.Type[] { krpc.client.Types.createDictionary(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32))) });
            RETURN_TYPES.put("IncrementSet", krpc.client.Types.createSet(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)));
            PARAMETER_TYPES.put("IncrementSet", new krpc.schema.KRPC.Type[] { krpc.client.Types.createSet(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)) });
            RETURN_TYPES.put("IncrementTuple", krpc.client.Types.createTuple(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32),krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT64)));
            PARAMETER_TYPES.put("IncrementTuple", new krpc.schema.KRPC.Type[] { krpc.client.Types.createTuple(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32),krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT64)) });
            RETURN_TYPES.put("Int32ToString", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("Int32ToString", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32) });
            RETURN_TYPES.put("Int64ToString", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("Int64ToString", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT64) });
            RETURN_TYPES.put("ListDefault", krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)));
            PARAMETER_TYPES.put("ListDefault", new krpc.schema.KRPC.Type[] { krpc.client.Types.createList(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)) });
            RETURN_TYPES.put("OnTimer", krpc.client.Types.createMessage(krpc.schema.KRPC.Type.TypeCode.EVENT));
            PARAMETER_TYPES.put("OnTimer", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.UINT32), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.UINT32) });
            RETURN_TYPES.put("OnTimerUsingLambda", krpc.client.Types.createMessage(krpc.schema.KRPC.Type.TypeCode.EVENT));
            PARAMETER_TYPES.put("OnTimerUsingLambda", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.UINT32) });
            RETURN_TYPES.put("OptionalArguments", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("OptionalArguments", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createClass("TestService", "TestClass") });
            RETURN_TYPES.put("ResetCustomExceptionLater", null);
            PARAMETER_TYPES.put("ResetCustomExceptionLater", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("ResetInvalidOperationExceptionLater", null);
            PARAMETER_TYPES.put("ResetInvalidOperationExceptionLater", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("ReturnNullWhenNotAllowed", krpc.client.Types.createClass("TestService", "TestClass"));
            PARAMETER_TYPES.put("ReturnNullWhenNotAllowed", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("SetDefault", krpc.client.Types.createSet(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)));
            PARAMETER_TYPES.put("SetDefault", new krpc.schema.KRPC.Type[] { krpc.client.Types.createSet(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32)) });
            RETURN_TYPES.put("StringToInt32", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32));
            PARAMETER_TYPES.put("StringToInt32", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING) });
            RETURN_TYPES.put("ThrowArgumentException", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32));
            PARAMETER_TYPES.put("ThrowArgumentException", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("ThrowArgumentNullException", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32));
            PARAMETER_TYPES.put("ThrowArgumentNullException", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING) });
            RETURN_TYPES.put("ThrowArgumentOutOfRangeException", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32));
            PARAMETER_TYPES.put("ThrowArgumentOutOfRangeException", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32) });
            RETURN_TYPES.put("ThrowCustomException", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32));
            PARAMETER_TYPES.put("ThrowCustomException", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("ThrowCustomExceptionLater", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32));
            PARAMETER_TYPES.put("ThrowCustomExceptionLater", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("ThrowInvalidOperationException", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32));
            PARAMETER_TYPES.put("ThrowInvalidOperationException", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("ThrowInvalidOperationExceptionLater", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32));
            PARAMETER_TYPES.put("ThrowInvalidOperationExceptionLater", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("TupleDefault", krpc.client.Types.createTuple(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32),krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BOOL)));
            PARAMETER_TYPES.put("TupleDefault", new krpc.schema.KRPC.Type[] { krpc.client.Types.createTuple(krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32),krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.BOOL)) });
            RETURN_TYPES.put("get_DeprecatedProperty", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("get_DeprecatedProperty", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("set_DeprecatedProperty", null);
            PARAMETER_TYPES.put("set_DeprecatedProperty", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING) });
            RETURN_TYPES.put("get_ObjectProperty", krpc.client.Types.createClass("TestService", "TestClass"));
            PARAMETER_TYPES.put("get_ObjectProperty", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("set_ObjectProperty", null);
            PARAMETER_TYPES.put("set_ObjectProperty", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass") });
            RETURN_TYPES.put("get_StringProperty", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("get_StringProperty", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("set_StringProperty", null);
            PARAMETER_TYPES.put("set_StringProperty", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING) });
            RETURN_TYPES.put("set_StringPropertyPrivateGet", null);
            PARAMETER_TYPES.put("set_StringPropertyPrivateGet", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING) });
            RETURN_TYPES.put("get_StringPropertyPrivateSet", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("get_StringPropertyPrivateSet", new krpc.schema.KRPC.Type[] {  });
            RETURN_TYPES.put("DeprecatedClass_DeprecatedMethod", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("DeprecatedClass_DeprecatedMethod", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "DeprecatedClass") });
            RETURN_TYPES.put("TestClass_FloatToString", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("TestClass_FloatToString", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass"), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.FLOAT) });
        }

        private static void initTypes1() {
            RETURN_TYPES.put("TestClass_GetValue", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("TestClass_GetValue", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass") });
            RETURN_TYPES.put("TestClass_ObjectToString", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("TestClass_ObjectToString", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass"), krpc.client.Types.createClass("TestService", "TestClass") });
            RETURN_TYPES.put("TestClass_OptionalArguments", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("TestClass_OptionalArguments", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass"), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createClass("TestService", "TestClass") });
            RETURN_TYPES.put("TestClass_get_IntProperty", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32));
            PARAMETER_TYPES.put("TestClass_get_IntProperty", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass") });
            RETURN_TYPES.put("TestClass_set_IntProperty", null);
            PARAMETER_TYPES.put("TestClass_set_IntProperty", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass"), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.SINT32) });
            RETURN_TYPES.put("TestClass_get_ObjectProperty", krpc.client.Types.createClass("TestService", "TestClass"));
            PARAMETER_TYPES.put("TestClass_get_ObjectProperty", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass") });
            RETURN_TYPES.put("TestClass_set_ObjectProperty", null);
            PARAMETER_TYPES.put("TestClass_set_ObjectProperty", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass"), krpc.client.Types.createClass("TestService", "TestClass") });
            RETURN_TYPES.put("TestClass_set_StringPropertyPrivateGet", null);
            PARAMETER_TYPES.put("TestClass_set_StringPropertyPrivateGet", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass"), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING) });
            RETURN_TYPES.put("TestClass_get_StringPropertyPrivateSet", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("TestClass_get_StringPropertyPrivateSet", new krpc.schema.KRPC.Type[] { krpc.client.Types.createClass("TestService", "TestClass") });
            RETURN_TYPES.put("TestClass_static_StaticMethod", krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING));
            PARAMETER_TYPES.put("TestClass_static_StaticMethod", new krpc.schema.KRPC.Type[] { krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING), krpc.client.Types.createValue(krpc.schema.KRPC.Type.TypeCode.STRING) });
        }

        public static krpc.schema.KRPC.Type getReturnType(String procedure) {
            if (!RETURN_TYPES.containsKey(procedure))
                throw new IllegalArgumentException("Procedure '" + procedure +"' not found");
            return RETURN_TYPES.get(procedure);
        }

        public static krpc.schema.KRPC.Type[] getParameterTypes(String procedure) {
            krpc.schema.KRPC.Type[] parameterTypes = PARAMETER_TYPES.get(procedure);
            if (parameterTypes == null)
                throw new IllegalArgumentException("Procedure '" + procedure +"' not found");
            return parameterTypes;
        }
    }
}
