boolean listen = source.contains("~");
try
{
URI address = new URI(listen ? source.replace("~", "") : source);
String hostName = address.getHost();
if (hostName == null) throw new MessengerException("Invalid source address (hostname cannot be null): " + source);
int port = address.getPort() < 0 ? defaultPort(address.getScheme()) : address.getPort();
if (listen)
{
if(_logger.isLoggable(Level.FINE))
{
_logger.fine(this + " about to subscribe to source " + source + " using address " + hostName + ":" + port);
}
_driver.createListener(hostName, port, null);
}
else
{
if(_logger.isLoggable(Level.FINE))
{
_logger.fine(this + " about to subscribe to source " + source);
}
getLink(hostName, port, new ReceiverFinder(cleanPath(address.getPath())));
}
}
catch (URISyntaxException e)
{
throw new MessengerException("Invalid source: " + source, e);
}
}