Package streamer

Examples of streamer.Element


        };
        /* @formatter:on */

        MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet, new byte[] {1, 2, 3}));
        NtlmState state = new NtlmState();
        Element ntlmssp_challenge = new ServerNtlmsspChallenge("ntlmssp_challenge", state);
        Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers());
        Element mainSink = new MockSink("mainSink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {1, 2, 3}));

        Pipeline pipeline = new PipelineImpl("test");
        pipeline.add(source, ntlmssp_challenge, sink, mainSink);
        pipeline.link("source", "ntlmssp_challenge", "mainSink");
        pipeline.link("ntlmssp_challenge >" + OTOUT, "sink");
View Full Code Here


        // System.setProperty("streamer.Link.debug", "true");
        System.setProperty("streamer.Element.debug", "true");
        // System.setProperty("streamer.Pipeline.debug", "true");

        Element source = new MockSource("source") {
            {
                // Split messages at random boundaries to check "pushback" logic
                bufs = ByteBuffer.convertByteArraysToByteBuffers(new byte[] {
                        // Message type: server bell
                        RfbConstants.SERVER_BELL,

                        // Message type: clipboard text
                        RfbConstants.SERVER_CUT_TEXT,
                        // Padding
                        0, 0, 0,
                        // Length (test)
                        0, 0, 0, 4,

                }, new byte[] {
                        // Clipboard text
                        't', 'e', 's', 't',

                        // Message type: frame buffer update
                        RfbConstants.SERVER_FRAMEBUFFER_UPDATE,
                        // Padding
                        0,
                        // Number of rectangles
                        0, 3,},

                        new byte[] {

                        // x, y, width, height: 0x0@4x4
                        0, 0, 0, 0, 0, 4, 0, 4,
                        // Encoding: desktop size
                        (byte)((RfbConstants.ENCODING_DESKTOP_SIZE >> 24) & 0xff), (byte)((RfbConstants.ENCODING_DESKTOP_SIZE >> 16) & 0xff),
                        (byte)((RfbConstants.ENCODING_DESKTOP_SIZE >> 8) & 0xff), (byte)((RfbConstants.ENCODING_DESKTOP_SIZE >> 0) & 0xff),},

                        new byte[] {

                        // x, y, width, height: 0x0@4x4
                        0, 0, 0, 0, 0, 4, 0, 4,
                        // Encoding: raw rect
                        (byte)((RfbConstants.ENCODING_RAW >> 24) & 0xff), (byte)((RfbConstants.ENCODING_RAW >> 16) & 0xff),
                        (byte)((RfbConstants.ENCODING_RAW >> 8) & 0xff), (byte)((RfbConstants.ENCODING_RAW >> 0) & 0xff),
                        // Raw pixel data 4x4x1 bpp
                        1, 2, 3, 4, 5, 6, 7, 8, 9, 10,}, new byte[] {11, 12, 13, 14, 15, 16,

                        // x, y, width, height: 0x0@2x2
                        0, 0, 0, 0, 0, 2, 0, 2,
                        // Encoding: copy rect
                        (byte)((RfbConstants.ENCODING_COPY_RECT >> 24) & 0xff), (byte)((RfbConstants.ENCODING_COPY_RECT >> 16) & 0xff),
                        (byte)((RfbConstants.ENCODING_COPY_RECT >> 8) & 0xff), (byte)((RfbConstants.ENCODING_COPY_RECT >> 0) & 0xff),
                        // srcX, srcY: 2x2
                        0, 2, 0, 2,});
            }
        };

        ScreenDescription screen = new ScreenDescription() {
            {
                bytesPerPixel = 1;
            }
        };

        final Element handler = new VncMessageHandler("handler", screen);

        ByteBuffer[] emptyBuf = ByteBuffer.convertByteArraysToByteBuffers(new byte[] {});
        Element fburSink = new MockSink("fbur", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {}, new byte[] {}));
        Element bellSink = new MockSink("bell", emptyBuf);
        Element clipboardSink = new MockSink("clipboard", emptyBuf);
        Element desktopSizeChangeSink = new MockSink("desktop_size", emptyBuf);
        Element pixelsSink = new MockSink("pixels",
                ByteBuffer.convertByteArraysToByteBuffers(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,}));
        Element copyRectSink = new MockSink("copy_rect", emptyBuf);

        Pipeline pipeline = new PipelineImpl("test");
        pipeline.addAndLink(source, handler);
        pipeline.add(fburSink, bellSink, clipboardSink, desktopSizeChangeSink, pixelsSink, copyRectSink);
View Full Code Here

        System.setProperty("streamer.Element.debug", "true");
        // System.setProperty("streamer.Pipeline.debug", "true");

        final String desktopName = "test";

        Element source = new MockSource("source") {
            {
                bufs = ByteBuffer.convertByteArraysToByteBuffers(
                        // Send screen description
                        new byte[] {
                                // Framebuffer width (short)
                                0, (byte)200,
                                // Framebuffer height (short)
                                0, 100,
                                // Bits per pixel
                                32,
                                // Depth,
                                24,
                                // Endianness flag
                                RfbConstants.LITTLE_ENDIAN,
                                // Truecolor flag
                                RfbConstants.TRUE_COLOR,
                                // Red max (short)
                                0, (byte)255,
                                // Green max (short)
                                0, (byte)255,
                                // Blue max (short)
                                0, (byte)255,
                                // Red shift
                                16,
                                // Green shift
                                8,
                                // Blue shift
                                0,
                                // Padding
                                0, 0, 0,
                                // Desktop name length (int)
                                0, 0, 0, 4,
                                // Desktop name ("test", 4 bytes)
                                't', 'e', 's', 't',

                                // Tail
                                1, 2, 3

                        },
                        // Tail packet
                        new byte[] {4, 5, 6});
            }
        };

        ScreenDescription screen = new ScreenDescription();
        final VncInitializer init = new VncInitializer("init", true, screen);
        Element initSink = new MockSink("initSink") {
            {
                // Expect shared flag
                bufs = ByteBuffer.convertByteArraysToByteBuffers(new byte[] {RfbConstants.SHARED_ACCESS});
            }
        };
        Element mainSink = new MockSink("mainSink") {
            {
                // Expect two tail packets
                bufs = ByteBuffer.convertByteArraysToByteBuffers(new byte[] {1, 2, 3}, new byte[] {4, 5, 6});
            }
        };
        ByteBuffer[] emptyBuf = ByteBuffer.convertByteArraysToByteBuffers(new byte[] {});
        Element encodingsSink = new MockSink("encodings", emptyBuf);
        Element pixelFormatSink = new MockSink("pixel_format", emptyBuf);

        Pipeline pipeline = new PipelineImpl("test");
        pipeline.addAndLink(source, init, mainSink);
        pipeline.add(encodingsSink, pixelFormatSink, initSink);
        pipeline.link("init >otout", "initSink");
View Full Code Here

    public static void main(String args[]) {
        System.setProperty("streamer.Element.debug", "true");

        ScreenDescription screen = new ScreenDescription();
        screen.setFramebufferSize(120, 80);
        Element adapter = new FrameBufferUpdateRequest("renderer", screen);

        Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {
                // Request
                RfbConstants.CLIENT_FRAMEBUFFER_UPDATE_REQUEST,
                // Full update (redraw area)
                RfbConstants.FRAMEBUFFER_FULL_UPDATE_REQUEST,
                // X
                0, 1,
                // Y
                0, 2,
                // Width
                0, 3,
                // Height
                0, 4}));

        ByteBuffer buf = new ByteBuffer(new byte[0]);
        buf.putMetadata(TARGET_X, 1);
        buf.putMetadata(TARGET_Y, 2);
        buf.putMetadata(WIDTH, 3);
        buf.putMetadata(HEIGHT, 4);

        Element source = new MockSource("source", new ByteBuffer[] {buf});

        Pipeline pipeline = new PipelineImpl("test");

        pipeline.addAndLink(source, adapter, sink);
        pipeline.runMainLoop("source", STDOUT, false, false);
View Full Code Here

        System.setProperty("streamer.Element.debug", "true");
        // System.setProperty("streamer.Pipeline.debug", "true");

        final String password = "test";

        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 Vnc33Authentication auth = new Vnc33Authentication("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)};
            }
        };
View Full Code Here

    @Test(expected = NullPointerException.class)
    public void testAssemblePipelineWhenMainElementIsNull() throws Exception {
        SocketWrapper socketMock = mock(SocketWrapper.class);
        when(socketMock.getId()).thenReturn("socket");
        Whitebox.setInternalState(Client.class, "socket", socketMock);
        Element main = null;

        Client.assemblePipeline(main);
    }
View Full Code Here

    public static void main(String args[]) {
        System.setProperty("streamer.Element.debug", "true");

        ScreenDescription screen = new ScreenDescription();
        screen.setFramebufferSize(120, 80);
        Element adapter = new FrameBufferUpdateRequest("renderer", screen);

        Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {
                // Request
                RfbConstants.CLIENT_FRAMEBUFFER_UPDATE_REQUEST,
                // Full update (redraw area)
                RfbConstants.FRAMEBUFFER_FULL_UPDATE_REQUEST,
                // X
                0, 1,
                // Y
                0, 2,
                // Width
                0, 3,
                // Height
                0, 4}));

        ByteBuffer buf = new ByteBuffer(new byte[0]);
        buf.putMetadata(TARGET_X, 1);
        buf.putMetadata(TARGET_Y, 2);
        buf.putMetadata(WIDTH, 3);
        buf.putMetadata(HEIGHT, 4);

        Element source = new MockSource("source", new ByteBuffer[] {buf});

        Pipeline pipeline = new PipelineImpl("test");

        pipeline.addAndLink(source, adapter, sink);
        pipeline.runMainLoop("source", STDOUT, false, false);
View Full Code Here

        System.setProperty("streamer.Element.debug", "true");
        // System.setProperty("streamer.Pipeline.debug", "true");

        final String password = "test";

        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)};
            }
        };
View Full Code Here

        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
    };
    /* @formatter:on */

        MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {1, 2, 3}));
        Element pcb = new ClientPreConnectionBlob("pcb", "39418F90-6D03-468E-B796-91C60DD6653A");
        Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(packet));
        Element mainSink = new MockSink("mainSink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {1, 2, 3}));

        Pipeline pipeline = new PipelineImpl("test");
        pipeline.add(source, pcb, sink, mainSink);
        pipeline.link("source", "pcb", "mainSink");
        pipeline.link("pcb >" + OTOUT, "sink");
View Full Code Here

        0x72, 0x00, 0x6c, 0x00, 0x64, 0x00, 0x00, 0x00//  CLIPRDR_FORMAT_DATA_RESPONSE::requestedFormatData: "hello world"
    };
    /* @formatter:on */

        MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
        Element router = new ServerClipRdrChannelRouter("router");
        ClipboardState state = new ClipboardState();
        state.serverRequestedFormat = new ClipboardDataFormat(ClipboardDataFormat.CB_FORMAT_UNICODETEXT, "");
        Element format_data_response = new ServerFormatDataResponsePDU("format_data_response", state);

        ByteBuffer clipboardAdapterPacket = new ByteBuffer(0);
        clipboardAdapterPacket.putMetadata(AwtClipboardAdapter.CLIPBOARD_CONTENT, "hello world");
        Element sink = new MockSink("sink", new ByteBuffer[] {clipboardAdapterPacket});

        Pipeline pipeline = new PipelineImpl("test");
        pipeline.add(source, router, format_data_response, sink);
        pipeline.link("source", "router >format_data_response", "format_data_response >clipboard", "sink");
        pipeline.runMainLoop("source", STDOUT, false, false);
View Full Code Here

TOP

Related Classes of streamer.Element

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.