Search in sources :

Example 1 with BcoSocketWrapperImpl

use of streamer.bco.BcoSocketWrapperImpl in project cloudstack by apache.

the class Client method runClient.

public void runClient(String[] args) {
    try {
        Protocol protocol = parseOptions(args);
        if (protocol == Protocol.NONE)
            return;
        System.setProperty("streamer.Link.debug", "" + debugLink.used);
        System.setProperty("streamer.Element.debug", "" + debugElement.used);
        System.setProperty("streamer.Pipeline.debug", "" + debugPipeline.used);
        SSLState sslState = new SSLState();
        // Create socket wrapper
        if ("jre".equals(sslImplementation.value)) {
            socket = new SocketWrapperImpl("socket", sslState);
        } else if ("apr".equals(sslImplementation.value)) {
            socket = new AprSocketWrapperImpl("socket", sslState);
        } else if ("bco".equals(sslImplementation.value)) {
            socket = new BcoSocketWrapperImpl("socket", sslState);
        } else {
            throw new RuntimeException("Unexpected option value: \"" + sslImplementation.value + "\". " + sslImplementation.help());
        }
        screen = new ScreenDescription();
        canvas = new BufferedImageCanvas(canvasWidth.value, canvasHeight.value);
        screen.addSizeChangeListener(new SizeChangeListener() {

            @Override
            public void sizeChanged(int width, int height) {
                if (canvas != null) {
                    canvas.setCanvasSize(width, height);
                    if (scroller != null)
                        scroller.setSize(canvas.getWidth(), canvas.getHeight());
                }
            }
        });
        assemblePipeline(setMainElementAndAddressBasedOnProtocol(protocol, sslState));
        frame = createVncClientMainWindow(canvas, protocol.toString() + " " + hostName.value, new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent evt) {
                shutdown();
            }
        });
        try {
            // Connect socket to remote server and run main loop(s)
            socket.connect(address);
        } finally {
            shutdown();
        }
    } catch (Exception e) {
        e.printStackTrace(System.err);
    }
}
Also used : WindowAdapter(java.awt.event.WindowAdapter) SocketWrapperImpl(streamer.SocketWrapperImpl) AprSocketWrapperImpl(streamer.apr.AprSocketWrapperImpl) BcoSocketWrapperImpl(streamer.bco.BcoSocketWrapperImpl) WindowEvent(java.awt.event.WindowEvent) AprSocketWrapperImpl(streamer.apr.AprSocketWrapperImpl) SSLState(streamer.ssl.SSLState) BcoSocketWrapperImpl(streamer.bco.BcoSocketWrapperImpl)

Aggregations

WindowAdapter (java.awt.event.WindowAdapter)1 WindowEvent (java.awt.event.WindowEvent)1 SocketWrapperImpl (streamer.SocketWrapperImpl)1 AprSocketWrapperImpl (streamer.apr.AprSocketWrapperImpl)1 BcoSocketWrapperImpl (streamer.bco.BcoSocketWrapperImpl)1 SSLState (streamer.ssl.SSLState)1