Class ListeningHandleImpl

  • All Implemented Interfaces:
    ListeningHandle


    public class ListeningHandleImpl
    extends java.lang.Object
    implements ListeningHandle
    Implementation of listening handle.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close​()
      Close listening socket.
      java.net.InetAddress getHost​()
      Get address of listening socket.
      int getPort​()
      Get port number of listening socket.
      static ListeningHandle startListening​(java.lang.String hostname, int port, java.lang.String certificatePath, ServerSocketEventsListener serverListener)
      Create new instance of listening handle that listens for incoming connections on designated port using TLS.
      static ListeningHandle startListening​(java.lang.String hostname, int port, ServerSocketEventsListener serverListener)
      Create new instance of listening handle that listens for incoming connections on designated port.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • startListening

        public static ListeningHandle startListening​(java.lang.String hostname,
                                                     int port,
                                                     ServerSocketEventsListener serverListener)
                                              throws ConnectorException
        Create new instance of listening handle that listens for incoming connections on designated port.
        Parameters:
        hostname - name of network interface, where to listen for connections or null for all interfaces
        port - port number
        serverListener - listener that handles incoming requests
        Returns:
        new instance of listening handle
        Throws:
        ConnectorException - when unable to connect
      • startListening

        public static ListeningHandle startListening​(java.lang.String hostname,
                                                     int port,
                                                     java.lang.String certificatePath,
                                                     ServerSocketEventsListener serverListener)
                                              throws ConnectorException
        Create new instance of listening handle that listens for incoming connections on designated port using TLS.
        Parameters:
        hostname - name of network interface, where to listen for connections or null for all interfaces
        port - port number
        certificatePath - path to file with certificate used in TLS
        serverListener - listener that handles incoming requests
        Returns:
        new instance of listening handle
        Throws:
        ConnectorException - when unable to connect
      • getHost

        public java.net.InetAddress getHost​()
        Description copied from interface: ListeningHandle
        Get address of listening socket.
        Specified by:
        getHost in interface ListeningHandle
        Returns:
        address of listening socket
      • getPort

        public int getPort​()
        Description copied from interface: ListeningHandle
        Get port number of listening socket.
        Specified by:
        getPort in interface ListeningHandle
        Returns:
        port number