/** Example. */ public static void main(String args[]) { // System.setProperty("streamer.Link.debug", "true"); System.setProperty("streamer.Element.debug", "true"); // System.setProperty("streamer.Pipeline.debug", "true"); final String password = "******"; Element source = new MockSource("source") { { bufs = ByteBuffer.convertByteArraysToByteBuffers( // Request authentication and send 16 byte challenge new byte[] { 0, 0, 0, RfbConstants.VNC_AUTH, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, // Respond to challenge with AUTH_OK new byte[] {0, 0, 0, RfbConstants.VNC_AUTH_OK}); } }; Element mainSink = new FakeSink("mainSink"); final Vnc_3_3_Authentication auth = new Vnc_3_3_Authentication("auth", password); Element initSink = new MockSink("initSink") { { // Expect encoded password bufs = new ByteBuffer[] { auth.encodePassword( new ByteBuffer( new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}), password) }; } }; Pipeline pipeline = new PipelineImpl("test"); pipeline.addAndLink(source, auth, mainSink); pipeline.add(initSink); pipeline.link("auth >otout", "initSink"); pipeline.runMainLoop("source", STDOUT, false, false); }