this.setConnectionStatus(FTPConnection.DISCONNECTED); fireConnectionStatusChanged(new FTPEvent(this,getConnectionStatus()));
setConnectionStatus(ERROR); fireConnectionStatusChanged(new FTPEvent(this, getConnectionStatus())); disconnect();
    private void streamFile(FTPFile fromFile, PipedInputStream pis) throws IOException, FtpWorkflowException, FtpIOException {                setConnectionStatus(RECEIVING_FILE_STARTED);        fireConnectionStatusChanged(new FTPEvent(this, getConnectionStatus(), fromFile, null));        setConnectionStatus(RECEIVING_FILE);        RetrieveCommand command = new RetrieveCommand(Command.RETR, fromFile, pis);        SocketProvider provider = null;        if (getConnectionType() == FTPConnection.AUTH_SSL_FTP_CONNECTION                || getConnectionType() == FTPConnection.AUTH_TLS_FTP_CONNECTION) {            Command pbsz = new Command(Command.PBSZ, "0");            (sendCommand(pbsz)).dumpReply();            Command prot = new Command(Command.PROT, "P");            (sendCommand(prot)).dumpReply();        }                // Send TYPE I        Command commandType = new Command(Command.TYPE_I);        (sendCommand(commandType)).dumpReply();        Reply commandReply = new Reply();        if (isPassiveMode()) {            provider = initDataSocket(command, commandReply);        } else {            provider = sendPortCommand(command, commandReply);        }        command.setDataSocket(provider);        // INFO response from ControllConnection is ignored        try {        	command.fetchDataConnectionReply(RetrieveCommand.STREAM_BASED);        }catch(IOException ioe) {        	setConnectionStatus(FTPConnection.DISCONNECTED);        	fireConnectionStatusChanged(new FTPEvent(this,getConnectionStatus()));        	throw ioe;        }        if (commandReply.getLines().size() == 1) {        	try {        		(ReplyWorker.readReply(socketProvider)).dumpReply();            }catch(IOException ioe) {            	this.setConnectionStatus(FTPConnection.DISCONNECTED);            	fireConnectionStatusChanged(new FTPEvent(this,getConnectionStatus()));            	throw ioe;            }        }        setConnectionStatus(RECEIVING_FILE_ENDED);        fireConnectionStatusChanged(new FTPEvent(this, getConnectionStatus(),                commandReply, fromFile, null));    }