mirror of
https://gitee.com/BDWare/sdk-java
synced 2025-01-09 17:34:19 +00:00
feat: update event subscriber
update test case for EventSubscriberClient
This commit is contained in:
parent
4ef2d7a74b
commit
07627ca2d7
@ -46,23 +46,23 @@ public class EventSubscriberClient implements Handler {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Map<String, String> setNodeID = new HashMap<>();
|
||||
setNodeID.put("action", "setNodeID");
|
||||
SM2KeyPair keyPair = SM2Util.generateSM2KeyPair(null);
|
||||
setNodeID.put("id", keyPair.getPublicKeyStr());
|
||||
|
||||
byte[] sig;
|
||||
try {
|
||||
sig =
|
||||
SM2Util.sign(
|
||||
keyPair.getPrivateKeyParameter(), keyPair.getPublicKeyStr().getBytes());
|
||||
setNodeID.put("signature", ByteUtils.toHexString(sig));
|
||||
|
||||
} catch (CryptoException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setNodeID.put("nodeName", "[LiteClient_" + System.currentTimeMillis() + "]");
|
||||
bc.sendText(new Gson().toJson(setNodeID));
|
||||
// Map<String, String> setNodeID = new HashMap<>();
|
||||
// setNodeID.put("action", "setNodeID");
|
||||
// SM2KeyPair keyPair = SM2Util.generateSM2KeyPair(null);
|
||||
// setNodeID.put("id", keyPair.getPublicKeyStr());
|
||||
//
|
||||
// byte[] sig;
|
||||
// try {
|
||||
// sig =
|
||||
// SM2Util.sign(
|
||||
// keyPair.getPrivateKeyParameter(), keyPair.getPublicKeyStr().getBytes());
|
||||
// setNodeID.put("signature", ByteUtils.toHexString(sig));
|
||||
//
|
||||
// } catch (CryptoException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// setNodeID.put("nodeName", "[LiteClient_" + System.currentTimeMillis() + "]");
|
||||
// bc.sendText(new Gson().toJson(setNodeID));
|
||||
}
|
||||
|
||||
public void subscribeEvent(String contractID, String topic) {
|
||||
|
@ -6,7 +6,7 @@ import java.util.Scanner;
|
||||
|
||||
public class EventClientTest {
|
||||
public static EventSubscriberClient getTestClient() {
|
||||
return new EventSubscriberClient("ws://162.105.175.243:1718/SCIDE/NodeCenter");
|
||||
return new EventSubscriberClient("ws://localhost:8080/SCIDE/SCExecutor");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
Loading…
Reference in New Issue
Block a user