Package mage.remote

Examples of mage.remote.Connection


            this.username = username;
        }

        public void connect() {
            session = new SessionImpl(this);
            Connection connection = new Connection();
            connection.setUsername(username);
            connection.setHost("localhost");
            connection.setPort(17171);
            connection.setProxyType(Connection.ProxyType.NONE);

            session.connect(connection);
        }
View Full Code Here


    @Ignore
    public void testStartGame() throws Exception {
        DeckCardLists deckList = createDeck();

        for (int i = 0; i < EXECUTION_COUNT; i++) {
            Connection connection = createConnection(TEST_USER_NAME + i);

            SimpleMageClient mageClient = new SimpleMageClient();
            Session session = new SessionImpl(mageClient);

            session.connect(connection);
            UUID roomId = session.getMainRoomId();

            GameTypeView gameTypeView = session.getGameTypes().get(0);
            log.info("Game type view: " + gameTypeView.getName());
            MatchOptions options = createGameOptions(gameTypeView, session);

            TableView table = session.createTable(roomId, options);

            if (!session.joinTable(roomId, table.getTableId(), TEST_USER_NAME + i, "Human", 1, deckList,"")) {
                log.error("Error while joining table");
                Assert.assertTrue("Error while joining table", false);
                return;
            }

            /*** Connect with a second player ***/
            Connection connection2 = createConnection(TEST_USER_NAME_2 + i);
            SimpleMageClient mageClient2 = new SimpleMageClient();
            Session session2 = new SessionImpl(mageClient2);
            session2.connect(connection2);
            UUID roomId2 = session2.getMainRoomId();

View Full Code Here

     * Players do nothing but skip phases and discard cards at the end.
     *
     * This results in a game that lasts until there is no cards in library.
     */
    private boolean testSimpleGame0(DeckCardLists deckList, int i) throws InterruptedException {
        Connection connection = createConnection(TEST_USER_NAME + i);

        SimpleMageClient mageClient = new SimpleMageClient();
        Session session = new SessionImpl(mageClient);

        session.connect(connection);

        mageClient.setSession(session);
        UUID roomId = session.getMainRoomId();

        GameTypeView gameTypeView = session.getGameTypes().get(0);
        log.info("Game type view: " + gameTypeView.getName());
        MatchOptions options = createGameOptions(gameTypeView, session);

        TableView table = session.createTable(roomId, options);

        if (!session.joinTable(roomId, table.getTableId(), TEST_USER_NAME + i, "Human", 1, deckList,"")) {
            log.error("Error while joining table");
            Assert.assertTrue("Error while joining table", false);
            return true;
        }

        /*** Connect with a second player ***/
        Connection connection2 = createConnection(TEST_USER_NAME_2 + i);
        SimpleMageClient mageClient2 = new SimpleMageClient();
        Session session2 = new SessionImpl(mageClient2);
        session2.connect(connection2);

        mageClient2.setSession(session2);
View Full Code Here

     *
     * @param username
     * @return
     */
    private Connection createConnection(String username) {
        Connection connection = new Connection();
        connection.setUsername(username);
        connection.setHost(TEST_SERVER);
        connection.setPort(TEST_PORT);
        Connection.ProxyType proxyType = Connection.ProxyType.valueByText(TEST_PROXY_TYPE);
        connection.setProxyType(proxyType);
        return connection;
    }
View Full Code Here

        logger.info("Config - lease period    : " + config.getLeasePeriod());
        logger.info("Config - max pool size   : " + config.getMaxPoolSize());
        logger.info("Config - num accp.threads: " + config.getNumAcceptThreads());
        logger.info("Config - second.bind port: " + config.getSecondaryBindPort());
       
        Connection connection = new Connection("&maxPoolSize=" + config.getMaxPoolSize());
        connection.setHost(config.getServerAddress());
        connection.setPort(config.getPort());
        try {
            // Parameter: serializationtype => jboss
            InvokerLocator serverLocator = new InvokerLocator(connection.getURI());               
            if (!isAlreadyRunning(serverLocator)) {
                server = new MageTransporterServer(serverLocator, new MageServerImpl(adminPassword, testMode), MageServer.class.getName(), new MageServerInvocationHandler());
                server.start();
                logger.info("Started MAGE server - listening on " + connection.toString());
               
                if (testMode) {
                    logger.info("MAGE server running in test mode");
                }
                initStatistics();
            }
            else {
                logger.fatal("Unable to start MAGE server - another server is already started");
            }
        } catch (IOException ex) {
            logger.fatal("Failed to start server - " + connection.toString(), ex);
        } catch (Exception ex) {
            logger.fatal("Failed to start server - " + connection.toString(), ex);
        }

    }
View Full Code Here

            txtPort.setText(ConsoleFrame.getPreferences().get("serverPort", Integer.toString(17171)));
            return;
        }

        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        connection = new Connection();
        connection.setHost(this.txtServer.getText());
        connection.setPort(Integer.valueOf(this.txtPort.getText()));
        connection.setPassword(new String(txtPassword.getPassword()));
        connection.setUsername("Admin");
        connection.setProxyType((ProxyType) this.cbProxyType.getSelectedItem());
View Full Code Here

        String proxyPassword = prefs.get("proxyPassword", "");
        int avatarId = PreferencesDialog.getSelectedAvatar();
        boolean showAbilityPickerForced = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_ABILITY_PICKER_FORCED, "true").equals("true");
        try {
            setCursor(new Cursor(Cursor.WAIT_CURSOR));
            Connection connection = new Connection();
            connection.setUsername(userName);
            connection.setHost(server);
            connection.setPort(port);
            connection.setProxyType(proxyType);
            connection.setProxyHost(proxyServer);
            connection.setProxyPort(proxyPort);
            connection.setProxyUsername(proxyUsername);
            connection.setProxyPassword(proxyPassword);
            connection.setAvatarId(avatarId);
            connection.setShowAbilityPickerForced(showAbilityPickerForced);
            connection.setUserSkipPrioritySteps(PreferencesDialog.getUserSkipPrioritySteps());
            logger.debug("connecting (auto): " + proxyType + " " + proxyServer + " " + proxyPort + " " + proxyUsername);
            if (MageFrame.connect(connection)) { 
                showGames(false);               
                return true;
            } else {
View Full Code Here

        }

        char[] input = new char[0];
        try {
            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            connection = new Connection();
            connection.setHost(this.txtServer.getText().trim());
            connection.setPort(Integer.valueOf(this.txtPort.getText().trim()));
            connection.setUsername(this.txtUserName.getText().trim());

            ProxyType configProxyType = Connection.ProxyType.valueByText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_PROXY_TYPE, "None"));
View Full Code Here

TOP

Related Classes of mage.remote.Connection

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.