try {
ExtendedNonblockingResolver resolver;
if (getDnsServiceMockStyle() == FAKE_SERVER) {
NonblockingResolver nonblockingResolver = new NonblockingResolver("127.0.0.1");
resolver = ExtendedNonblockingResolver.newInstance(new NonblockingResolver[] {nonblockingResolver});
nonblockingResolver.setPort(FAKE_SERVER_PORT);
nonblockingResolver.setTCP(false);
} else if (getDnsServiceMockStyle() == REAL_SERVER) {
resolver = ExtendedNonblockingResolver.newInstance();
Resolver[] resolvers = resolver.getResolvers();
for (int i = 0; i < resolvers.length; i++) {
resolvers[i].setTCP(false);