Well, the conclusion of the RXTX posts in this blog may have been written in this code sample. It will help you to establish serial port operations (connect / disconnect / add data available listener / get serial port’s OutputStream/InputStream).
I put this on the blog, because I keep moving around project to project. Hence, it always take a lot of time to find it from one of the project folders. At least, if I keep it online, google will help me to find it when I need it.
This second loopback program is to test RXTX’s serial event (data available event). Note that you need serial loopback to use this source code.
One comment that I had in this site said that the RXTX library is not very reliable in the receiving part (using data available event).
I’m unsure whether it happens because of the RXTX implementation (in the application side) or RXTX library has internal bug. So, here’s some simple loopback test program to test the RXTX.