@Test public void testGetKeyReferences(){ ArrayList<Address> addresses = new ArrayList<>(); for(String addr : publicKeys){ try { Address address = new Address(addr); addresses.add(address); } catch (MalformedAddressException e) { System.out.println("MalformedAddressException. Msg: "+e.getMessage()); } } mWebSocket.addListener(new GetKeyReferences(addresses, new WitnessResponseListener() { @Override public void onSuccess(WitnessResponse response) { System.out.println("onSuccess"); int counter = 0; List<List<UserAccount>> accountListList = (List<List<UserAccount>>) response.result; for(List<UserAccount> accountList : accountListList){ for(UserAccount userAccount : accountList){ System.out.println("User account: "+userAccount.getObjectId()); } if(accountList.size() > 1){ System.out.println("Key with address: "+publicKeys[counter]+" controls more than one role in account: "+accountList.get(0).getObjectId()); }else if(accountList.size() == 1){ System.out.println("Key with address: "+publicKeys[counter]+" controls just one role in account: "+accountList.get(0).getObjectId()); } counter++; } synchronized (GetKeyReferencesTest.this){ GetKeyReferencesTest.this.notifyAll(); } } @Override public void onError(BaseResponse.Error error) { System.out.println("onError. Msg: "+error.message); synchronized (GetKeyReferencesTest.this){ GetKeyReferencesTest.this.notifyAll(); } } })); try{ mWebSocket.connect(); synchronized (this){ wait(); } } catch (WebSocketException e) { System.out.println("WebSocketException. Msg: " + e.getMessage()); } catch (InterruptedException e) { System.out.println("InterruptedException. Msg: "+e.getMessage()); } }
public GetKeyReferences(Address address, boolean oneTime, WitnessResponseListener listener){ super(listener); addresses = new ArrayList<>(); addresses.add(address); this.mOneTime = oneTime; }
GetKeyReferences extends BaseGrapheneHandler { public GetKeyReferences(Address address, boolean oneTime, WitnessResponseListener listener){ super(listener); addresses = new ArrayList<>(); addresses.add(address); this.mOneTime = oneTime; } }
GetKeyReferences extends BaseGrapheneHandler { public GetKeyReferences(Address address, boolean oneTime, WitnessResponseListener listener){ super(listener); addresses = new ArrayList<>(); addresses.add(address); this.mOneTime = oneTime; } GetKeyReferences(Address address, boolean oneTime, WitnessResponseListener listener);  GetKeyReferences(List<Address> addresses, boolean oneTime, WitnessResponseListener listener);  GetKeyReferences(Address address, WitnessResponseListener listener);  GetKeyReferences(List<Address> addresses, WitnessResponseListener listener); }
GetKeyReferences extends BaseGrapheneHandler { public GetKeyReferences(Address address, boolean oneTime, WitnessResponseListener listener){ super(listener); addresses = new ArrayList<>(); addresses.add(address); this.mOneTime = oneTime; } GetKeyReferences(Address address, boolean oneTime, WitnessResponseListener listener);  GetKeyReferences(List<Address> addresses, boolean oneTime, WitnessResponseListener listener);  GetKeyReferences(Address address, WitnessResponseListener listener);  GetKeyReferences(List<Address> addresses, WitnessResponseListener listener); @Override void onConnected(WebSocket websocket, Map<String, List<String>> headers); @Override void onTextFrame(WebSocket websocket, WebSocketFrame frame); @Override void onFrameSent(WebSocket websocket, WebSocketFrame frame); }
GetKeyReferences extends BaseGrapheneHandler { public GetKeyReferences(Address address, boolean oneTime, WitnessResponseListener listener){ super(listener); addresses = new ArrayList<>(); addresses.add(address); this.mOneTime = oneTime; } GetKeyReferences(Address address, boolean oneTime, WitnessResponseListener listener);  GetKeyReferences(List<Address> addresses, boolean oneTime, WitnessResponseListener listener);  GetKeyReferences(Address address, WitnessResponseListener listener);  GetKeyReferences(List<Address> addresses, WitnessResponseListener listener); @Override void onConnected(WebSocket websocket, Map<String, List<String>> headers); @Override void onTextFrame(WebSocket websocket, WebSocketFrame frame); @Override void onFrameSent(WebSocket websocket, WebSocketFrame frame);  }