Package org.apache.commons.net.ftp

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


            try {

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

            } catch(SocketException e) {
                logger.logMessage(
                    "SocketException while connecting to host " + host + ", aborting",
View Full Code Here


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

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

        server.stop();
        initServer();
       
        // let's generate some stats
        FTPClient client1 = new FTPClient();
        client1.connect("localhost", port);
       
        assertTrue(client1.login(ADMIN_USERNAME, ADMIN_PASSWORD));
        assertTrue(client1.makeDirectory("foo"));
        assertTrue(client1.makeDirectory("foo2"));
        assertTrue(client1.removeDirectory("foo2"));
View Full Code Here

       
        assertTrue(client1.logout());
        client1.disconnect();

        FTPClient client2 = new FTPClient();
        client2.connect("localhost", port);

        assertTrue(client2.login(ANONYMOUS_USERNAME, ANONYMOUS_PASSWORD));
        // done setting up stats
       
        client.connect("localhost", port);
View Full Code Here

        OutputStream output = null;

        res.sampleStart();
        FTPClient ftp = new FTPClient();
    try {
      ftp.connect(getServer());
      res.latencyEnd();
      int reply = ftp.getReplyCode();
            if (FTPReply.isPositiveCompletion(reply))
            {
              if (ftp.login( getUsername(), getPassword())){
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

                client.setParserFactory(myFactory);
            }

            try
            {
                client.connect(hostname, port);

                int reply = client.getReplyCode();
                if (!FTPReply.isPositiveCompletion(reply))
                {
                    throw new FileSystemException("vfs.provider.ftp/connect-rejected.error", hostname);
View Full Code Here

        {
            dir = args[3];
        }

        FTPClient client = new FTPClient();
        client.connect(host);
        int reply = client.getReplyCode();
        if (!FTPReply.isPositiveCompletion(reply))
        {
            throw new IllegalArgumentException("cant connect: " + reply);
        }
View Full Code Here

    public Object makeObject() throws Exception
    {
        FTPClient client = new FTPClient();
        if (uri.getPort() > 0)
        {
            client.connect(uri.getHost(), uri.getPort());
        }
        else
        {
            client.connect(uri.getHost());
        }
View Full Code Here

        {
            client.connect(uri.getHost(), uri.getPort());
        }
        else
        {
            client.connect(uri.getHost());
        }
        if (!FTPReply.isPositiveCompletion(client.getReplyCode()))
        {
            throw new IOException("Ftp connect failed: " + client.getReplyCode());
        }
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.