Package ch.unifr.nio.framework.mockups

Examples of ch.unifr.nio.framework.mockups.MyClientSocketChannelHandler


        logger.addHandler(consoleHandler);

        Dispatcher dispatcher = new Dispatcher();
        dispatcher.start();

        MyClientSocketChannelHandler handler =
                new MyClientSocketChannelHandler();
        dispatcher.registerClientSocketChannelHandler(
                "localhost", 11111, handler);

        // wait until connectFailed() was called by the framework
        for (int i = 0; !handler.hasConnectFailed() && i < 10; i++) {
            Thread.sleep(1000);
        }
        assertTrue("connectFailed() was never called!", handler.hasConnectFailed());
    }
View Full Code Here


        // start NIO framework
        Dispatcher dispatcher = new Dispatcher();
        dispatcher.start();

        MyClientSocketChannelHandler handler =
                new MyClientSocketChannelHandler();
        dispatcher.registerClientSocketChannelHandler(
                "2.2.2.2", 80, handler, 3000);

        // wait until connectFailed() was called by the framework
        for (int i = 0; !handler.hasConnectFailed() && i < 10; i++) {
            Thread.sleep(1000);
        }
        assertTrue("connectFailed() was never called!",
                handler.hasConnectFailed());
    }
View Full Code Here

        final int PORT = 11111;
        TestTarget testTarget = new TestTarget(PORT);
        testTarget.start();
        testTarget.getSocketChannel();

        MyClientSocketChannelHandler handler =
                new MyClientSocketChannelHandler();
        dispatcher.registerClientSocketChannelHandler(
                "localhost", PORT, handler);

        // wait until connectSucceeded() was called by the framework
        for (int i = 0; !handler.connectSucceededCalled && i < 10; i++) {
View Full Code Here

        // start NIO framework
        Dispatcher dispatcher = new Dispatcher();
        dispatcher.start();

        MyClientSocketChannelHandler handler =
                new MyClientSocketChannelHandler();
        dispatcher.registerClientSocketChannelHandler(
                "öäü.öäü", 0, handler, 3000);

        // wait until resolveFailed() was called by the framework
        for (int i = 0; !handler.hasResolveFailed() && (i < 30); i++) {
            Thread.sleep(1000);
        }
        assertTrue("resolveFailed() was never called!",
                handler.hasResolveFailed());

        // check that connectFailed() will not be called too, because of the
        // timeout
        Thread.sleep(4000);
        assertFalse("connectFailed() was called too",
                handler.hasConnectFailed());
    }
View Full Code Here

        TrafficShaperCoordinator trafficShaperCoordinator =
                new TrafficShaperCoordinator(
                Executors.newSingleThreadScheduledExecutor(),
                1000, DELAY, false);
        trafficShaperCoordinator.addTrafficShaper(
                new MyClientSocketChannelHandler(),
                dummyTrafficOutputForwarder);
        trafficShaperCoordinator.start();
        Thread.sleep(DELAY / 2);
        transferredInput = myByteBufferCopyForwarder.getInput();
        assertNull("trafficShaperCoordinator did not wait for initial data "
View Full Code Here

TOP

Related Classes of ch.unifr.nio.framework.mockups.MyClientSocketChannelHandler

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.