I had the same problem (with the Java application crashing when connecting to COM4). Turns out it needs a very specific version of Java, the Java 8 update 101. After I uninstalled the new version of Java and installed Java 8 update 101, I can connect to the SA6 with the app through COM4 and it doesn't crash.
I learned this fact from his video: https://www.youtube.com/watch?v=6qoaRAb8AkU I used this link to download the Java 8 u101 https://filehippo.com/download_java-development-kit-64/8-update-101/
I hope this message finds you! It doesn't help with the control codes, but solves your original problem.