-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeaderTest.java
More file actions
38 lines (32 loc) · 1.11 KB
/
HeaderTest.java
File metadata and controls
38 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import javax.swing.JFrame;
import javax.swing.JTree;
/**
* Tests the DNSHeaderImpl and DNSHeaderGuiDecorator by creating a new
* DNSHeader, filling it with fudged values, wrapping it in a
* DNSHeaderGuiDecorator and displaying it.
*
* @author Chris Blades
* @version 20/3/2010
*/
public class HeaderTest {
public static void main(String[] args) {
DNSFlagsField flags = new DNSFlagsFieldImpl();
flags.setIsRequest(true);
flags.setAuthoritative(true);
flags.setOpcode(DNSOpcodeEnum.STATUS);
DNSHeader header = new DNSHeaderImpl();
header.setIdentifier(666);
header.setFlags(flags);
header.setNumQuestions(2);
header.setNumAnswers(3);
header.setNumAuthorityAnswers(4);
header.setNumAdditionalAnswers(5);
DNSHeaderGuiDecorator dec =
new DNSHeaderGuiDecorator(header);
JFrame frame = new JFrame("DNS Resolver");
frame.setSize(300, 500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new JTree(dec));
frame.setVisible(true);
}
}