|
|
@ -320,13 +320,6 @@ public class SocketFetcher {
|
|
|
|
logger.finest("set socket read timeout " + to);
|
|
|
|
logger.finest("set socket read timeout " + to);
|
|
|
|
socket.setSoTimeout(to);
|
|
|
|
socket.setSoTimeout(to);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int writeTimeout = PropUtil.getIntProperty(props,
|
|
|
|
|
|
|
|
prefix + ".writetimeout", -1);
|
|
|
|
|
|
|
|
if (writeTimeout != -1) { // wrap original
|
|
|
|
|
|
|
|
if (logger.isLoggable(Level.FINEST))
|
|
|
|
|
|
|
|
logger.finest("set socket write timeout " + writeTimeout);
|
|
|
|
|
|
|
|
socket = new WriteTimeoutSocket(socket, writeTimeout);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (localaddr != null)
|
|
|
|
if (localaddr != null)
|
|
|
|
socket.bind(new InetSocketAddress(localaddr, localport));
|
|
|
|
socket.bind(new InetSocketAddress(localaddr, localport));
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -383,7 +376,7 @@ public class SocketFetcher {
|
|
|
|
ssf = (SSLSocketFactory)sf;
|
|
|
|
ssf = (SSLSocketFactory)sf;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ssf = (SSLSocketFactory)SSLSocketFactory.getDefault();
|
|
|
|
ssf = (SSLSocketFactory)SSLSocketFactory.getDefault();
|
|
|
|
socket = ssf.createSocket(socket, host, port, true);
|
|
|
|
socket = ssf.createSocket(WriteTimeoutSocket.unwrap(socket), host, port, true);
|
|
|
|
sf = ssf;
|
|
|
|
sf = ssf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -393,7 +386,7 @@ public class SocketFetcher {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
configureSSLSocket(socket, host, props, prefix, sf);
|
|
|
|
configureSSLSocket(socket, host, props, prefix, sf);
|
|
|
|
|
|
|
|
|
|
|
|
return socket;
|
|
|
|
return WriteTimeoutSocket.wrap(socket, props, prefix, logger);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -543,7 +536,7 @@ public class SocketFetcher {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
socket = ssf.createSocket(socket, host, port, true);
|
|
|
|
socket = ssf.createSocket(WriteTimeoutSocket.unwrap(socket), host, port, true);
|
|
|
|
configureSSLSocket(socket, host, props, prefix, ssf);
|
|
|
|
configureSSLSocket(socket, host, props, prefix, ssf);
|
|
|
|
} catch (Exception ex) {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
if (ex instanceof InvocationTargetException) {
|
|
|
|
if (ex instanceof InvocationTargetException) {
|
|
|
@ -563,7 +556,7 @@ public class SocketFetcher {
|
|
|
|
ioex.initCause(ex);
|
|
|
|
ioex.initCause(ex);
|
|
|
|
throw ioex;
|
|
|
|
throw ioex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return socket;
|
|
|
|
return WriteTimeoutSocket.wrap(socket, props, prefix, logger);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|