Difficult to say... it seems to be the download side which decides to closes the connection...
BTW: Using Log4J makes logging output much easier to configure, here is a little doc
http://www.phex.org/wiki/index.php/Logging_API
This is an example log4j.properties:
Code:
log4j.rootLogger=DEBUG, Console, StandardFile, ErrorFile
log4j.logger.IncomingMessages=WARN
log4j.logger.IncomingMessages.Dropped=WARN
log4j.logger.OUTGOING_MESSAGES=WARN
log4j.logger.LOCALIZATION=WARN
log4j.logger.BANDWIDTH=WARN
log4j.logger.UDP_OUTGOING_MESSAGES=INFO
log4j.logger.UDP_INCOMING_MESSAGES=DEBUG
log4j.logger.phex.common.file=WARN
log4j.logger.phex.common.file.ManagedFileInputStream=WARN
log4j.additivity.phex.common.file.ManagedFileInputStream=false
log4j.logger.phex.common.file.ManagedFileOutputStream=WARN
log4j.additivity.phex.common.file.ManagedFileOutputStream=false
log4j.logger.org.apache.commons.httpclient=WARN, StandardFile, ErrorFile
log4j.logger.httpclient.wire=WARN, StandardFile, ErrorFile
#### Console Appender ####
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d{yyMMdd HH:mm:ss,SSS} %-5p/%c [%t]:: %m%n
#### Standard File Appender ####
log4j.appender.StandardFile=org.apache.log4j.RollingFileAppender
log4j.appender.StandardFile.File=phex.l4j.log
log4j.appender.StandardFile.MaxFileSize=1024KB
log4j.appender.StandardFile.MaxBackupIndex=5
log4j.appender.StandardFile.layout=org.apache.log4j.PatternLayout
log4j.appender.StandardFile.layout.ConversionPattern=%d{yyMMdd HH:mm:ss,SSS}(%r) %-5p/%c [%t]:: %m%n
#### Error File Appender ####
log4j.appender.ErrorFile=org.apache.log4j.RollingFileAppender
log4j.appender.ErrorFile.File=phex.error.l4j.log
log4j.appender.ErrorFile.MaxFileSize=512KB
log4j.appender.ErrorFile.MaxBackupIndex=1
log4j.appender.ErrorFile.Threshold=ERROR
log4j.appender.ErrorFile.layout=org.apache.log4j.PatternLayout
log4j.appender.ErrorFile.layout.ConversionPattern=%d{yyMMdd HH:mm:ss,SSS}(%r) %-5p/%c [%t]:: %m%n