public boolean login(String userName, String host, int port) {
        freeColClient.setMapEditor(false);
 
        freeColClient.askServer().disconnect();

        try {

            freeColClient.askServer().connect(FreeCol.CLIENT_THREAD + userName,
                    host, port, freeColClient.getPreGameInputHandler());
            
        } catch (Exception e) {
            gui.errorMessage("server.couldNotConnect", e.getMessage());
            return false;
        }

        LoginMessage msg = freeColClient.askServer()
            .login(userName, FreeCol.getVersion());
        Game game;
        if (msg == null || (game = msg.getGame()) == null) return false;

        // This completes the client's view of the spec with options
        // obtained from the server difficulty.  It should not be
        // required in the client, to be removed later, when newTurn()
        // only runs in the server
        freeColClient.setGame(game);
        Player player = game.getPlayerByName(userName);
        if (player == null) {
            logger.warning("New game does not contain player: " + userName);
            return false;
        }
        freeColClient.setMyPlayer(player);
        freeColClient.addSpecificationActions(game.getSpecification());
        logger.info("FreeColClient logged in as " + userName
                    + "/" + player.getId());

        // Reconnect
        if (msg.getStartGame()) {
            Tile entryTile = (player.getEntryLocation() == null) ? null
                : player.getEntryLocation().getTile();
            freeColClient.setSinglePlayer(msg.isSinglePlayer());
            freeColClient.getPreGameController().startGame();

            if (msg.isCurrentPlayer()) {
                freeColClient.getInGameController()
                    .setCurrentPlayer(player);
                Unit activeUnit = msg.getActiveUnit();
                if (activeUnit != null) {
                    activeUnit.getOwner().resetIterators();
                    activeUnit.getOwner().setNextActiveUnit(activeUnit);
                    gui.setActiveUnit(activeUnit);
                } else {
                    gui.setSelectedTile(entryTile, false);
                }
            } else {
                gui.setSelectedTile(entryTile, false);
            }
        }

        // All done.
        freeColClient.setLoggedIn(true);
        return true;
    }