public void connect(String threadName, String host, int port, MessageHandler messageHandler) 
        throws ConnectException, IOException {
        int tries;
            if (port < 0) {
                port = FreeCol.getDefaultPort();
                tries = 10;
            } else {
                tries = 1;
            }
            for (int i = tries; i > 0; i--) {
                try {
                    client = new Client(host, port,
                                        messageHandler,
                                        threadName);
                    if (client != null) 
                        break;
                } catch (ConnectException e) {
                    if (i == 1) 
                        throw e;
                } catch (IOException e) {
                    if (i == 1) 
                        throw e;
                }
            }
    }