static public void registerClasses (final Kryo kryo) {
		kryo.register(Object[].class);
		kryo.register(InvokeMethod.class);

		FieldSerializer<InvokeMethodResult> resultSerializer = new FieldSerializer<InvokeMethodResult>(kryo,
			InvokeMethodResult.class) {
			public void write (Kryo kryo, Output output, InvokeMethodResult result) {
				super.write(kryo, output, result);
				output.writeInt(result.objectID, true);
			}

			public InvokeMethodResult read (Kryo kryo, Input input, Class<InvokeMethodResult> type) {
				InvokeMethodResult result = super.read(kryo, input, type);
				result.objectID = input.readInt(true);
				return result;
			}
		};
		resultSerializer.removeField("objectID");
		kryo.register(InvokeMethodResult.class, resultSerializer);

		kryo.register(InvocationHandler.class, new Serializer() {
			public void write (Kryo kryo, Output output, Object object) {
				RemoteInvocationHandler handler = (RemoteInvocationHandler)Proxy.getInvocationHandler(object);
				output.writeInt(handler.objectID, true);
			}

			public Object read (Kryo kryo, Input input, Class type) {
				int objectID = input.readInt(true);
				Connection connection = (Connection)kryo.getContext().get("connection");
				Object object = getRegisteredObject(connection, objectID);
				if (WARN && object == null) warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection);
				return object;
			}
		});
	}
static public void registerClasses ( final Kryo kryo ) { kryo . register ( Object [ ] . class ) ; kryo . register ( InvokeMethod . class ) ; FieldSerializer < InvokeMethodResult > resultSerializer = new FieldSerializer < InvokeMethodResult > ( kryo , InvokeMethodResult . class ) { public void write ( Kryo kryo , Output output , InvokeMethodResult result ) { super . write ( kryo , output , result ) ; output . writeInt ( result . objectID , true ) ; } public InvokeMethodResult read ( Kryo kryo , Input input , Class < InvokeMethodResult > type ) { InvokeMethodResult result = super . read ( kryo , input , type ) ; result . objectID = input . readInt ( true ) ; return result ; } } ; resultSerializer . removeField ( "objectID" ) ; kryo . register ( InvokeMethodResult . class , resultSerializer ) ; kryo . register ( InvocationHandler . class , new Serializer ( ) { public void write ( Kryo kryo , Output output , Object object ) { RemoteInvocationHandler handler = ( RemoteInvocationHandler ) Proxy . getInvocationHandler ( object ) ; output . writeInt ( handler . objectID , true ) ; } public Object read ( Kryo kryo , Input input , Class type ) { int objectID = input . readInt ( true ) ; Connection connection = ( Connection ) kryo . getContext ( ) . get ( "connection" ) ; Object object = getRegisteredObject ( connection , objectID ) ; if ( WARN && object == null ) warn ( "kryonet" , "Unknown object ID " + objectID + " for connection: " + connection ) ; return object ; } } ) ; }
Registers the classes needed to use ObjectSpaces. This should be called before any connections are opened.
@see Kryo#register(Class, Serializer)