Class HubTester.ClientWatcher

  • All Implemented Interfaces:
    CallableClient
    Enclosing class:
    HubTester

    private static class HubTester.ClientWatcher
    extends java.lang.Object
    implements CallableClient
    CallableClient implementation which watches hub.event messages concerning the registration and attributes of other clients.
    • Field Detail

      • clientMap_

        private final java.util.Map clientMap_
      • error_

        private java.lang.Throwable error_
    • Constructor Detail

      • ClientWatcher

        ClientWatcher​(HubConnection connection)
        Constructor.
        Parameters:
        connection - hub connection
    • Method Detail

      • getClient

        public HubTester.WatchedClient getClient​(java.lang.String id)
        Returns a WatchedClient object corresponding to a given client public ID. This will contain information about the hub event messages this watcher has received concerning that client up till now.
        Parameters:
        id - public id of a client which has been registered
        Returns:
        watchedClient object if any messages have been received about id, otherwise null
      • getError

        public java.lang.Throwable getError()
        Returns an error if any error has been thrown during processing of hub event messages.
        Returns:
        deferred throwable, or null in case of no problems
      • getConnection

        public HubConnection getConnection()
        Returns the hub connection used by this client.
        Returns:
        hub connection
      • receiveCall

        public void receiveCall​(java.lang.String senderId,
                                java.lang.String msgId,
                                Message msg)
        Description copied from interface: CallableClient
        Receives a message for which a response is required. The implementation must take care to call the hub's reply method at some future point.
        Specified by:
        receiveCall in interface CallableClient
        Parameters:
        senderId - public ID of sending client
        msgId - message identifier for later use with reply
        msg - message
      • receiveNotification

        public void receiveNotification​(java.lang.String senderId,
                                        Message msg)
        Description copied from interface: CallableClient
        Receives a message for which no response is required.
        Specified by:
        receiveNotification in interface CallableClient
        Parameters:
        senderId - public ID of sending client
        msg - message
      • processMessage

        private void processMessage​(java.lang.String senderId,
                                    Message msg)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • receiveResponse

        public void receiveResponse​(java.lang.String responderId,
                                    java.lang.String msgTag,
                                    Response response)
        Description copied from interface: CallableClient
        Receives a response to a message previously sent by this client.
        Specified by:
        receiveResponse in interface CallableClient
        Parameters:
        responderId - public ID of responding client
        msgTag - client-defined tag labelling previously-sent message
        response - returned response object
      • getSubscriptions

        public static Subscriptions getSubscriptions()
        Returns a suitable subscriptions object for this client.
        Returns:
        subscriptions
      • getMetadata

        public static Metadata getMetadata()
        Returns a suitable metadata object for this client.