Package net.windwards.dnsfrontend.api

Examples of net.windwards.dnsfrontend.api.Protocol


                'b', 'a', 'r' // domain moniker
        };

        TestingConfiguration conf = new TestingConfiguration("bar", "example.com.", 12345);

        Protocol protocol = new BinaryBackendProtocol();
        Record result = protocol.decode(ipv4message, conf);
        ARecord rec = (ARecord) result;
        Assert.assertEquals("foo.example.com.", rec.getName().toString());
        Assert.assertEquals("192.168.0.1", rec.getAddress().getHostAddress());
        Assert.assertEquals(12345, rec.getTTL());
    }
View Full Code Here


                'b', 'a', 'r'
        };

        TestingConfiguration conf = new TestingConfiguration("bar", "example.com.", 12345);

        Protocol protocol = new BinaryBackendProtocol();
        Record result = protocol.decode(ipv6message, conf);
        AAAARecord rec = (AAAARecord) result;
        Assert.assertEquals("foo.example.com.", rec.getName().toString());
        Assert.assertEquals("2002:53fe:52a1:7:224:1dff:fe7d:6bef", rec.getAddress().getHostAddress());
        Assert.assertEquals(12345, rec.getTTL());
    }
View Full Code Here

    @Test
    public void encodeRequest() throws Exception {
        TestingConfiguration conf = new TestingConfiguration("bar", "example.com.", 12345);

        Protocol protocol = new JSONBackendProtocol();

        Record rec = Record.newRecord(new Name("foo.example.com."), Type.A, DClass.IN);
        byte[] data = protocol.encode(rec, conf);

        String expectedStr = "{ \"type\": \"Request\", \"moniker\": \"bar\", \"name\": \"foo\" }";
        Map<String, Object> expected = mapper.readValue(expectedStr, new TypeReference<HashMap<String, Object>>(){});
        Map<String, Object> actual = mapper.readValue(data, new TypeReference<HashMap<String, Object>>(){});
View Full Code Here

                "\"name\": \"foo\", " +
                "\"address\": \"192.168.0.1\", " +
                "\"family\": \"ipv4\", " +
                "\"moniker\": \"bar\" }";

        Protocol protocol = new JSONBackendProtocol();
        Record result = protocol.decode(update.getBytes(), conf);

        ARecord rec = (ARecord) result;
        Assert.assertEquals("foo.example.com.", rec.getName().toString());
        Assert.assertEquals("192.168.0.1", rec.getAddress().getHostAddress());
        Assert.assertEquals(12345, rec.getTTL());
View Full Code Here

                "\"name\": \"foo\", " +
                "\"address\": \"2002:53fe:52a1:7:224:1dff:fe7d:6bef\", " +
                "\"family\": \"ipv6\", " +
                "\"moniker\": \"bar\" }";

        Protocol protocol = new JSONBackendProtocol();
        Record result = protocol.decode(update.getBytes(), conf);

        AAAARecord rec = (AAAARecord) result;
        Assert.assertEquals("foo.example.com.", rec.getName().toString());
        Assert.assertEquals("2002:53fe:52a1:7:224:1dff:fe7d:6bef", rec.getAddress().getHostAddress());
        Assert.assertEquals(12345, rec.getTTL());
View Full Code Here

    @Ignore("Meaningful only when run alone")
    @Test
    public void firstSerialisationPerformance() throws Exception {
        TestingConfiguration conf = new TestingConfiguration("bar", "example.com.", 12345);

        Protocol protocol = new JSONBackendProtocol();

        Record rec = Record.newRecord(new Name("foo.example.com."), Type.A, DClass.IN);
        long start = System.currentTimeMillis();
        byte[] data = protocol.encode(rec, conf);
        long consumed = System.currentTimeMillis() - start;
        System.out.println(consumed);
        Assert.assertTrue(consumed < 25);
    }
View Full Code Here

TOP

Related Classes of net.windwards.dnsfrontend.api.Protocol

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.