use of com.rabbitmq.client.DnsRecordIpAddressResolver in project rabbitmq-java-client by rabbitmq.
the class DnsRecordIpAddressResolverTests method loopbackInterfaceResolution.
@Test
public void loopbackInterfaceResolution() throws IOException, TimeoutException {
DnsRecordIpAddressResolver addressResolver = new DnsRecordIpAddressResolver("127.0.0.1");
ConnectionFactory connectionFactory = newConnectionFactory();
Connection connection = connectionFactory.newConnection(addressResolver);
try {
connection.createChannel();
} finally {
connection.abort();
}
}
use of com.rabbitmq.client.DnsRecordIpAddressResolver in project rabbitmq-java-client by rabbitmq.
the class DnsRecordIpAddressResolverTests method localhostResolution.
@Test
public void localhostResolution() throws IOException, TimeoutException {
DnsRecordIpAddressResolver addressResolver = new DnsRecordIpAddressResolver("localhost");
ConnectionFactory connectionFactory = newConnectionFactory();
Connection connection = connectionFactory.newConnection(addressResolver);
try {
connection.createChannel();
} finally {
connection.abort();
}
}
use of com.rabbitmq.client.DnsRecordIpAddressResolver in project rabbitmq-java-client by rabbitmq.
the class DnsRecordIpAddressResolverTests method resolutionFails.
@Test
public void resolutionFails() throws IOException, TimeoutException {
DnsRecordIpAddressResolver addressResolver = new DnsRecordIpAddressResolver("afancyandunlikelyhostname");
try {
connectionFactory.newConnection(addressResolver);
fail("The host resolution should have failed");
} catch (UnknownHostException e) {
// expected
}
}
Aggregations