package org.xbib.files.ftp.test;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.net.ConnectException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import org.xbib.files.ftp.FTPClient;

public class TestConnectTimeout {

    @Test
    public void testConnectTimeout() throws SocketException, IOException {
        FTPClient client = new FTPClient();
        client.setConnectTimeout(1000);
        try {
            client.connect("www.apache.org", 1234);
            fail("Expecting an Exception");
        } catch (ConnectException | SocketTimeoutException | UnknownHostException se) {
            assertTrue(true);
        } // Not much we can do about this, we may be firewalled
    }
}
