测试利用mgmt发送注册前缀

This commit is contained in:
free will
2021-05-14 09:48:06 +08:00
parent cd610d7b5e
commit 4cc1c88ed2
2 changed files with 18 additions and 3 deletions
+2 -2
View File
@@ -142,11 +142,11 @@ public class LogicFaceTest {
data.setName(name);
LogicFace face=new LogicFace();
face.initWithUdp("127.0.0.1",50000);
face.initWithUdp("192.168.3.9",50000);
face.sendData(data);
// 等待两秒钟,接收数据包
Data data1 = face.receiveData(4000);
Data data1 = face.receiveData(9000);
System.out.println(Arrays.toString(
new SelfEncodingBase().selfWireEncode(data1).getRaw()));
}catch (LogicFaceException | ComponentException | EncoderException | BlockException | PacketException | MgmtException e){
@@ -1,6 +1,12 @@
package mgmt;
import component.ComponentException;
import component.Identifier;
import logicface.LogicFace;
import logicface.LogicFaceException;
import org.junit.Test;
import security.KeyChain;
/*
* @Author: Wang Feng
@@ -11,7 +17,16 @@ import org.junit.Test;
*/
public class RegisterPrefixHelperTest {
@Test
public void registerPrefixTest(){
public void registerPrefixTest() throws Exception {
// 注册前缀Identifier
Identifier identifier=new Identifier("/hello/wefree");
// 初始化face
LogicFace face=new LogicFace();
face.initWithUdp("127.0.0.1",50000);
// 初始化KeyChain
// KeyChain keyChain=new KeyChain();
RegisterPrefixHelper helper=new RegisterPrefixHelper();
helper.registerPrefix(identifier,face,null);
}
}