Examples of HostId


Examples of net.sf.agentopia.util.net.HostId

    @Override
    public void connectToNetwork(HostId routerId) throws IOException {
        // (1) Connect to servers denoted by router.
        String[] hostList = host.contactRouter(routerId);
        for (String hostName : hostList) {
            HostId targetHostId = new HostId(hostName);
            host.createSustainer(host.getMarketPlace(), targetHostId, host.getHomeId());
            testServerCount++;
        }

        // (2) Connect to router itself.
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

     */
    public HostEnvironment(boolean isAutomaticMarket) throws Exception {
        this.isAutomaticMarket = isAutomaticMarket;

        // Determine local host name.
        HostId localId = new HostId(80);
        String hostName = localId.getHostBasicName();
        if (-1 != hostName.indexOf(':')) {
            throw new IllegalArgumentException("Hostname must not have port: " + hostName);
        }

        // Create hosts.
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

            OS.checkSecurityManagerPresent();
        }

        // Create simulated network of test servers.
        env = new HostEnvironment(true);
        HostId routerId = env.host1.getHomeId();

        // A new test box must be created here.
        // And connected to the test server network.
        testBox = new TestBox(15907);
        testBox.connectToNetwork(routerId);
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

        // Add 2-set of results.
        List<ITestActionResult> res1 = new ArrayList<ITestActionResult>();
        res1.add(new TestActionResult());
        res1.add(new TestActionResult());
        treasure.addTestResults(res1, new HostId("localhost:15908"));

        // Add 3-set of results.
        List<ITestActionResult> res2 = new ArrayList<ITestActionResult>();
        res2.add(new TestActionResult());
        res2.add(new TestActionResult());
        res2.add(new TestActionResult());
        treasure.addTestResults(res2, new HostId("localhost:15908"));

        // See whether all results arrived.
        final int agentCount = treasure.getAgentCount();
        assertEquals(2, agentCount);
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

        // Create new test box.
        ITestBox box = new TestBox(15907);

        // Connect box with other hosts.
        final HostId routerId = env.host1.getHomeId();
        box.connectToNetwork(routerId);

        // Test server count.
        final int testServerCount = box.getTestServerCount();
        assertEquals(2, testServerCount);
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

     * (2) Use the routers from config to get their exits.
     */
    private void createExits() {
        final Config conf = getLocalConfig();
        String hostName;
        HostId hostId;

        // (1) Get all the _HOSTS_ from the config file.
        for (String hostKey : conf.keys("host")) {
            if (getExitCount() >= this.maximumExitCount) {
                break;
            }
            hostName = conf.get(hostKey, null);
            if (null != hostName) {
                try {
                    hostId = new HostId(hostName);
                    createExit(hostId);
                }
                catch (IOException exc) {
                    // Host not reachable or rejected. No problem.
                }
            }
        }

        // (2) Get all the _ROUTERS_ from config file.
        for (String routerKey : conf.keys("router")) {
            hostName = conf.get(routerKey, null);
            if (null != hostName) {
                try {
                    hostId = new HostId(hostName);
                    createExitsFromRouter(hostId);
                }
                catch (IOException exc) {
                    // Host was not reachable. Skip it.
                    if (AgentopiaConstants.NETWORK_DEBUG) {
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

            for (int pos = 0; pos < hostCount; pos++) {
                if (getExitCount() >= this.maximumExitCount) {
                    return;
                }
                try {
                    HostId hostId = new HostId(hostArray[pos]);
                    createExit(hostId);
                }
                catch (IOException exc) {
                    // Rejected or unreachable.
                }
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

            JOptionPane.showMessageDialog(HostStarterPanel.this, msg);
        }
        if (isStartHost) {
            getHostNameTextField().setEditable(false);
            getHostNameTextField().setBackground(Color.green);
            final HostId hostId = getController().getHost().getHomeId();
            getHostNameTextField().setText(hostId.getHostBasicName());
            getPortTextField().setText(Integer.toString(hostId.getPort()));
            getHostStartToggleButton().setText("Stop Host");
        }
        else {
            getHostNameTextField().setEditable(true);
            getHostNameTextField().setBackground(Color.orange);
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

        host = new Host(port);

        // Replace host id with specific name.
        if (!"localhost".equals(hostName)) {
            try {
                final HostId hostId = new HostId(hostName + ":" + portString);
                if (!hostId.isLocalHost()) {
                    throw new IOException("Alternative host id is not a local address: " + hostId);
                }
                host.setHomeId(hostId);
            }
            catch (IOException exc) {
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

        if (null == host || !host.isAlive()) {
            throw new IllegalStateException("Host not alive, cannot start serviteurs.");
        }

        // Determine other side host id.
        HostId hostId = new HostId(hostName);

        // Add exit.
        host.getMarketPlace().createExit(hostId);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.