Package org.apache.commons.net.ftp

Examples of org.apache.commons.net.ftp.FTPClient.connect()


        FTPClient ftp = new FTPClient();
        try {
            savedClient = ftp;
            final int port = getPortAsInt();
            if (port > 0){
                ftp.connect(getServer(),port);               
            } else {
                ftp.connect(getServer());
            }
            res.latencyEnd();
            int reply = ftp.getReplyCode();
View Full Code Here


            savedClient = ftp;
            final int port = getPortAsInt();
            if (port > 0){
                ftp.connect(getServer(),port);               
            } else {
                ftp.connect(getServer());
            }
            res.latencyEnd();
            int reply = ftp.getReplyCode();
            if (FTPReply.isPositiveCompletion(reply))
            {
View Full Code Here

    /**
     * @see java.net.URLConnection#getInputStream()
     */
    public InputStream getInputStream() throws IOException {
        FTPClient client = new FTPClient();
        client.connect(host);
        String replyString = client.getReplyString();
        int replyCode = client.getReplyCode();
        if (!FTPReply.isPositiveCompletion(replyCode)) {
            client.disconnect();
            throw new IOException(replyString);
View Full Code Here

        LOG.info("*****load from server done******");
        assertTrue(FileUtils.contentEquals(new File(from.getPath()), new File(response.getPath())));
        LOG.info("*****assert files done******");
        new File(prefix + "2.pdf").delete();
        FTPClient client = new FTPClient();
        client.connect(readConfig.getUrl());
        client.login(readConfig.getLogin(), readConfig.getPass());
        client.deleteFile("~/backup/1/1.pdf");
        client.disconnect();
        LOG.info("*****clean directories done******\n");
    }
View Full Code Here

    }

    protected FTPClient getClient() throws IOException {
        FTPClient client = new FTPClient();
        log.debug("connect to host " + getHost());
        client.connect(getHost());
        log.debug("login using username " + getUsername());
        if (!client.login(getUsername(), getPassword())){
            throw new IOException("user is not login, code " + client.getReplyCode() + ", message: " + client.getReplyString());
        }
        return client;
View Full Code Here

            if (task.isConfigurationSet()) {
                ftp = FTPConfigurator.configure(ftp, task);
            }

            ftp.setRemoteVerificationEnabled(task.getEnableRemoteVerification());
            ftp.connect(task.getServer(), task.getPort());
            if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
                throw new BuildException("FTP connection failed: "
                                         + ftp.getReplyString());
            }
View Full Code Here

        try {
            client1.connect("localhost", port);
            client2.connect("localhost", port);
            client3.connect("localhost", port);
            client4.connect("localhost", port);

            assertTrue(client1.login(TESTUSER1_USERNAME, TESTUSER_PASSWORD));
            assertTrue(client2.login(TESTUSER1_USERNAME, TESTUSER_PASSWORD));
            assertTrue(client3.login(TESTUSER1_USERNAME, TESTUSER_PASSWORD));
View Full Code Here

            }
            int reply;
           
            try {
                if(port != -1) {
                    ftp.connect(host, port);
                } else {
                    ftp.connect(host);
                }
            } catch(SocketException e) {
                logger.logMessage("SocketException while connecting to host " + host + ", aborting", this, MessageLogger.ERROR);
View Full Code Here

           
            try {
                if(port != -1) {
                    ftp.connect(host, port);
                } else {
                    ftp.connect(host);
                }
            } catch(SocketException e) {
                logger.logMessage("SocketException while connecting to host " + host + ", aborting", this, MessageLogger.ERROR);
                PipeComponentUtils.failTransfer();
            } catch(IOException e) {
View Full Code Here

            int reply;

            try {

                if(port != -1) {
                    ftp.connect(host, port);
                } else {
                    ftp.connect(host);
                }

            } catch(SocketException e) {
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.