SITL + Java can't change flight mode

Hi all,
I’m writing some Java code to control a quadcopter. It is based on the code from the DroidPlanner project on GitHub ( https://github.com/DroidPlanner ), using the Desktop example from the DroneKit-Android project. It uses also the Java MavLink library.
My code is able to connect the drone (via the serial port) or SITL via a TCP connection and I’m able to receive and parse all the MavLink messages.
I would like to test my code with a SITL, but it seems the SITL doesn’t react well to the messages I send and I cannot change flight mode.

Here is my setup:
Linux box running my java code in Eclipse and SITL started and working. When I test it on the simulator, it seems I cannot change the flight mode: every time I switch i.e. to loiter, then it returns back to stabilize. I use the following command in Java:

drone.getState().setMode(ApmModes.ROTOR_LOITER); (following the droidplanner code).
If I start the python mavproxy module (with the --console option) and connect it to the same SITL session via another TCP port, the console window doesn’t show the mode switch (i.e from stabilize to loiter), but only the mode the SITL was set on. If I change the mode from the mavproxy command line with:

both the mavproxy console & my code react to the change and switch to the right flight mode.
Moreover, it seems that if I run the same code directly on the quadcopter, the PixHawk reacts correctly.
However, I’d like to test my full program on the SITL before running it on the copter…

Anyone can help?