mirror of
https://gitee.com/BDWare/sdk-java
synced 2025-01-10 01:44: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();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String, String> setNodeID = new HashMap<>();
|
// Map<String, String> setNodeID = new HashMap<>();
|
||||||
setNodeID.put("action", "setNodeID");
|
// setNodeID.put("action", "setNodeID");
|
||||||
SM2KeyPair keyPair = SM2Util.generateSM2KeyPair(null);
|
// SM2KeyPair keyPair = SM2Util.generateSM2KeyPair(null);
|
||||||
setNodeID.put("id", keyPair.getPublicKeyStr());
|
// setNodeID.put("id", keyPair.getPublicKeyStr());
|
||||||
|
//
|
||||||
byte[] sig;
|
// byte[] sig;
|
||||||
try {
|
// try {
|
||||||
sig =
|
// sig =
|
||||||
SM2Util.sign(
|
// SM2Util.sign(
|
||||||
keyPair.getPrivateKeyParameter(), keyPair.getPublicKeyStr().getBytes());
|
// keyPair.getPrivateKeyParameter(), keyPair.getPublicKeyStr().getBytes());
|
||||||
setNodeID.put("signature", ByteUtils.toHexString(sig));
|
// setNodeID.put("signature", ByteUtils.toHexString(sig));
|
||||||
|
//
|
||||||
} catch (CryptoException e) {
|
// } catch (CryptoException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
setNodeID.put("nodeName", "[LiteClient_" + System.currentTimeMillis() + "]");
|
// setNodeID.put("nodeName", "[LiteClient_" + System.currentTimeMillis() + "]");
|
||||||
bc.sendText(new Gson().toJson(setNodeID));
|
// bc.sendText(new Gson().toJson(setNodeID));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void subscribeEvent(String contractID, String topic) {
|
public void subscribeEvent(String contractID, String topic) {
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Scanner;
|
|||||||
|
|
||||||
public class EventClientTest {
|
public class EventClientTest {
|
||||||
public static EventSubscriberClient getTestClient() {
|
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) {
|
public static void main(String[] args) {
|
||||||
|
Loading…
Reference in New Issue
Block a user