Package net.windwards.dnsfrontend.api

Examples of net.windwards.dnsfrontend.api.Protocol.encode()


        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


        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
Copyright © 2018 www.massapi.com. 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.