Package org.xbill.DNS

Examples of org.xbill.DNS.Message


        }
        this.processMessage(message);
    }

    public void timeout() {
        Message message = new Message();
        message.getHeader().setFlag(Flags.QR);
        message.getHeader().setFlag(Flags.AA);
        message.getHeader().setRcode(Rcode.NXDOMAIN);
        logger.info("No answer [query={}]", this.query);
        this.processMessage(message);
    }
View Full Code Here


        logger.info("No answer [query={}]", this.query);
        this.processMessage(message);
    }

    public void refuse() {
        Message message = new Message();
        message.getHeader().setFlag(Flags.QR);
        message.getHeader().setRcode(Rcode.REFUSED);
        logger.info("Not implemented type [query={}]", this.query);
        this.processMessage(message);
    }
View Full Code Here

        task.run();

        Assert.assertEquals(1, replies.size());
        Assert.assertEquals(0, notified.size());

        Message result = replies.get(0);
        ARecord arec = (ARecord) result.getSectionArray(Section.ANSWER)[0];
        Assert.assertEquals("127.0.0.1", arec.getAddress().getHostAddress());
    }
View Full Code Here

        Assert.assertEquals(1, parked.size());
        Assert.assertEquals(0, replies.size());

        task.answer(TestUtils.getReplyRecord(), true);

        Message result = replies.get(0);
        Assert.assertTrue(result.getHeader().getFlag(Flags.AA));
        ARecord arec = (ARecord) result.getSectionArray(Section.ANSWER)[0];
        Assert.assertEquals("127.0.0.1", arec.getAddress().getHostAddress());
    }
View Full Code Here

        task.run();

        Assert.assertEquals(0, parked.size());

        Message result = replies.get(0);
        Assert.assertFalse(result.getHeader().getFlag(Flags.AA));
        Assert.assertEquals(Rcode.NXDOMAIN, result.getRcode());
    }
View Full Code Here

        });

        task.run();
        task.timeout();

        Message result = replies.get(0);
        Assert.assertTrue(result.getHeader().getFlag(Flags.AA));
        Assert.assertEquals(Rcode.NXDOMAIN, result.getRcode());
    }
View Full Code Here

    @Test
    public void refuseUnimplementedQueryType() throws Exception {
        final List<Message> replies = new LinkedList<Message>();

        Message message = Message.newQuery(Record.newRecord(new Name("foo.example.com."), Type.AFSDB, DClass.IN));
        Query query = TestUtils.getQuery(replies, message);
        ResolveTask task = new ResolveTask(query);
        task.setCache(TestUtils.getEhcache());
        task.setBackendStore(new BackendRepository() {
            @Override
            public Backend lookup(int type) {
                return null;
            }
            @Override public void stop() {}
        });

        task.run();

        Message result = replies.get(0);
        Assert.assertEquals(Rcode.REFUSED, result.getRcode());
    }
View Full Code Here

            @Override public void stop() {}
        });

        task.run();

        Message result = replies.get(0);
        Assert.assertEquals(Rcode.REFUSED, result.getRcode());
    }
View Full Code Here

        Record reply = new AAAARecord(new Name("foo.example.com."), DClass.IN,
                1800, InetAddress.getByName("2002:53fe:52a1:7::c9d9"));

        task.answer(reply, false);

        Message result = replies.get(0);
        Assert.assertEquals(Rcode.SERVFAIL, result.getRcode());
    }
View Full Code Here

        return cache;
    }

    public static Query getQuery(final List<Message> replies) throws TextParseException, UnknownHostException {
        Message message = Message.newQuery(Record.newRecord(new Name("foo.example.com."), Type.A, DClass.IN));
        return getQuery(replies, message);
    }
View Full Code Here

TOP

Related Classes of org.xbill.DNS.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.