a bug in tightvnc java library
I found a bug for the tightvnc java library, if my setup like this
tightvnc (java) -> java proxy server -> java proxy server -> vnc server
IT doesn’t work, after I trace the code, this could caused by this line:
this.is = new DataInputStream(new BufferedInputStream(is));
In Reader.java constructor, it is called twice. You can see that if you set a breakpoint in doInBackground() in SwingRfbConnectionWorker. The BufferedInputStream will cache the bytes immediately, so if it is called two times, the cached bytes will exist in one reader instance only. So I think this is the root cause.
To fix it, please change the code to “private static DataInputStream is;”, I changed the “DataInputStream is;” to static, so make sure the buffered bytes are cached into same stream, then the bug gone.