Package org.jgroups.util

Examples of org.jgroups.util.PortsManager


    PortsManager pm;
    final static int START_PORT=15550;

    protected void setUp() throws Exception {
        super.setUp();
        pm=new PortsManager();
        pm.deleteFile();
    }
View Full Code Here


        pm=new PortsManager();
        pm.deleteFile();
    }

    protected void tearDown() throws Exception {
        pm=new PortsManager();
        pm.deleteFile();
        super.tearDown();
    }
View Full Code Here

        pm.deleteFile();
        super.tearDown();
    }

    public void testAddition() {
        pm=new PortsManager(30000);
        List<Integer> ports=new LinkedList<Integer>();

        for(int i=0; i < 10; i++) {
            int port=pm.getNextAvailablePort(START_PORT);
            assertTrue(port > 0);
View Full Code Here

        assertEquals(10, ports.size());
    }


    public void testNonDuplicateAddition() {
        pm=new PortsManager(30000);

        int port=pm.getNextAvailablePort(START_PORT);
        System.out.println("port=" + port);
        assertEquals(START_PORT, port);
View Full Code Here

        assertNotSame(port, port2);
    }


    public void testExpiration() {
        pm=new PortsManager(800);

        int port=pm.getNextAvailablePort(START_PORT);
        System.out.println("port = " + port);
        Util.sleep(900);
        int port2=pm.getNextAvailablePort(START_PORT);
View Full Code Here

        System.out.println("port=" + port + ", port2=" + port2);
        assertNotSame(port, port2);
    }

    public void testRemove() {
        pm=new PortsManager(10000);
        int port=pm.getNextAvailablePort(START_PORT);
        int old_port=port;
        System.out.println("port = " + port);
        assertEquals(START_PORT, port);
        int port2=pm.getNextAvailablePort(START_PORT);
View Full Code Here

TOP

Related Classes of org.jgroups.util.PortsManager

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.