use of dev.hawala.xns.level4.common.ChsDatabase in project dodo by devhawala.
the class TestChsDatabase method main.
public static void main(String[] args) {
ChsDatabase chsdb = new ChsDatabase(1033, "org.o", "dom.d", "./chs-database", true);
chsdb.dump();
}
use of dev.hawala.xns.level4.common.ChsDatabase in project dodo by devhawala.
the class DodoTest method testBfsChsService.
private static void testBfsChsService() throws XnsException {
ChsDatabase chsDatabase = new ChsDatabase(0x1122_3344, "organization", "domain", null, true);
Clearinghouse3Impl.init(0x1122_3344, 0xAABB_CCDD_EEFFL, chsDatabase);
localSite.pexListen(IDP.KnownSocket.CLEARINGHOUSE.getSocket(), new BfsClearinghouseResponder());
byte[] requestData = { 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x56, 0x78, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00 };
Payload response = localSite.pexRequest(IDP.BROADCAST_ADDR, IDP.KnownSocket.CLEARINGHOUSE.getSocket(), PEX.ClientType.CLEARINGHOUSE.getTypeValue(), requestData, 0, requestData.length);
if (response == null) {
System.out.println("bfs response: null (timeout)\n");
} else if (response instanceof PEX) {
System.out.println("bfs response is of type: PEX\n");
PEX pex = (PEX) response;
System.out.printf("=> PEX: %s\n", pex.toString());
System.out.printf("=> PEX.payload: %s\n", pex.payloadToString());
} else if (response instanceof Error) {
System.out.println("bfs response is of type: Error\n");
} else {
System.out.printf("bfs response is of unexpected type: %s\n", response.getClass().getName());
}
}
Aggregations