public URLConnection openConnection(URL url) throws IOException {
String host = url.getHost();
URLConnection connection;
if (host != null && host.length() != 0) {
logMessage("Connect: " + host + ", waiting for reply.");
connectionUtil = new ConnectionUtil(url);
connection = connectionUtil.openConnection();
logMessage("Connected to " + host);
} else {
connection = url.openConnection();
}