@Test public void testGlobalPropertiesDeserializer(){ try{ mMessagesHub = new SubscriptionMessagesHub("", "", true, mErrorListener); mMessagesHub.addSubscriptionListener(new SubscriptionListener() { private int MAX_MESSAGES = 10; private int messageCounter = 0; @Override public ObjectType getInterestObjectType() { return ObjectType.DYNAMIC_GLOBAL_PROPERTY_OBJECT; } @Override public void onSubscriptionUpdate(SubscriptionResponse response) { System.out.println("On block"); if(response.params.size() == 2){ try{ List<Object> payload = (List) response.params.get(1); if(payload.size() > 0 && payload.get(0) instanceof DynamicGlobalProperties){ DynamicGlobalProperties globalProperties = (DynamicGlobalProperties) payload.get(0); } }catch(Exception e){ System.out.println("Exception"); System.out.println("Type: "+e.getClass()); System.out.println("Msg: "+e.getMessage()); } } messageCounter++; if(messageCounter > MAX_MESSAGES){ synchronized (SubscriptionMessagesHubTest.this){ SubscriptionMessagesHubTest.this.notifyAll(); } } } }); mMessagesHub.addSubscriptionListener(new SubscriptionListener() { @Override public ObjectType getInterestObjectType() { return ObjectType.TRANSACTION_OBJECT; } @Override public void onSubscriptionUpdate(SubscriptionResponse response) { System.out.println("onTx"); } }); mWebSocket.addListener(mMessagesHub); 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()); } }
@Override public void addSubscriptionListener(SubscriptionListener listener){ this.mSubscriptionDeserializer.addSubscriptionListener(listener); }
SubscriptionMessagesHub extends BaseGrapheneHandler implements SubscriptionHub { @Override public void addSubscriptionListener(SubscriptionListener listener){ this.mSubscriptionDeserializer.addSubscriptionListener(listener); } }
SubscriptionMessagesHub extends BaseGrapheneHandler implements SubscriptionHub { @Override public void addSubscriptionListener(SubscriptionListener listener){ this.mSubscriptionDeserializer.addSubscriptionListener(listener); } SubscriptionMessagesHub(String user, String password, boolean clearFilter, NodeErrorListener errorListener);  SubscriptionMessagesHub(String user, String password, NodeErrorListener errorListener); }
SubscriptionMessagesHub extends BaseGrapheneHandler implements SubscriptionHub { @Override public void addSubscriptionListener(SubscriptionListener listener){ this.mSubscriptionDeserializer.addSubscriptionListener(listener); } SubscriptionMessagesHub(String user, String password, boolean clearFilter, NodeErrorListener errorListener);  SubscriptionMessagesHub(String user, String password, NodeErrorListener errorListener); @Override void addSubscriptionListener(SubscriptionListener listener); @Override void removeSubscriptionListener(SubscriptionListener listener); @Override List<SubscriptionListener> getSubscriptionListeners(); @Override void onConnected(WebSocket websocket, Map<String, List<String>> headers); @Override void onTextFrame(WebSocket websocket, WebSocketFrame frame); @Override void onFrameSent(WebSocket websocket, WebSocketFrame frame); void resubscribe(); void cancelSubscriptions(); boolean isSubscribed(); void reset(); void addRequestHandler(BaseGrapheneHandler handler); void setPrintLogs(boolean printLogs); boolean isPrintLogs(); }
SubscriptionMessagesHub extends BaseGrapheneHandler implements SubscriptionHub { @Override public void addSubscriptionListener(SubscriptionListener listener){ this.mSubscriptionDeserializer.addSubscriptionListener(listener); } SubscriptionMessagesHub(String user, String password, boolean clearFilter, NodeErrorListener errorListener);  SubscriptionMessagesHub(String user, String password, NodeErrorListener errorListener); @Override void addSubscriptionListener(SubscriptionListener listener); @Override void removeSubscriptionListener(SubscriptionListener listener); @Override List<SubscriptionListener> getSubscriptionListeners(); @Override void onConnected(WebSocket websocket, Map<String, List<String>> headers); @Override void onTextFrame(WebSocket websocket, WebSocketFrame frame); @Override void onFrameSent(WebSocket websocket, WebSocketFrame frame); void resubscribe(); void cancelSubscriptions(); boolean isSubscribed(); void reset(); void addRequestHandler(BaseGrapheneHandler handler); void setPrintLogs(boolean printLogs); boolean isPrintLogs(); final static int LOGIN_ID; final static int GET_DATABASE_ID; final static int SUBSCRIPTION_REQUEST; final static int SUBSCRIPTION_NOTIFICATION; final static int MANUAL_SUBSCRIPTION_ID; }