Interface ServerSocketEventsListener

    • Method Detail

      • createEventsListener

        D2ConnectorEventsListener createEventsListener​(java.net.InetAddress address,
                                                       int port,
                                                       ListeningHandle handle)
                                                throws ConnectionRejectedException
        Called to accept or reject new incoming connection and possibly provide an instance of D2ConnectorEventsListener for constructor of new D2Connector instance. Method is called prior triple handshake procedure.

        Incoming connection is accepted by returning either instance of connector listener or null if no listener is required.

        Incoming connection is validly rejected by throwing ConnectionRejectedException. Connection would be rejected also if call throws any RuntimeException although it is considered an error that is logged accordingly.

        Parameters:
        address - address of connecting remote host
        port - port of connecting remote host
        handle - handle to listening socket
        Returns:
        instance of listener or null to be used as a parameter for construction of a new instance of D2Connector when incoming connection is to be accepted by application layer
        Throws:
        ConnectionRejectedException - when incoming connection is to be rejected
      • onConnectionEstabilished

        void onConnectionEstabilished​(D2Connector connector,
                                      java.net.InetAddress address,
                                      int port,
                                      ListeningHandle handle)
        Called when triple handshake connection verified validity of connecting client and new instance of D2Connector has been created. Instance is ready for use.
        Parameters:
        connector - new instance of connector ready for use
        address - remote address of D2Connector.exe
        port - port of connected remote D2Connector.exe
        handle - handle to listening socket
      • onConnectionFailed

        void onConnectionFailed​(ConnectorException ex,
                                java.net.InetAddress address,
                                int port,
                                ListeningHandle handle)
        Called when connecting client does not pass through initial triple handshake procedure. It happens when the client does not use JAPI communication protocol or when different version of D2Connector.exe attempts to connect.
        Parameters:
        ex - actual exception that was thrown during connection establishment
        address - address of remote client
        port - port of remote client
        handle - handle to listening socket