Class SocketEndPoint

All Implemented Interfaces:
BaseEndPoint, ConnectionTypeHolder, SecurityModeHolder, EndPoint, Closeable, GroupCloseable, OpennessRequestable, AutoCloseable

public final class SocketEndPoint extends AbstractNetEndPoint
Author:
Silvan Wyss
  • Method Details

    • toHostAndHttpPortAndDefaultSlot

      public static SocketEndPoint toHostAndHttpPortAndDefaultSlot(String host)
      Parameters:
      host -
      Returns:
      a new SocketEndPoint that will connect to the default slot on the HTTP port on the given host.
    • toHostAndPortAndDefaultSlot

      public static SocketEndPoint toHostAndPortAndDefaultSlot(String host, int port)
      Parameters:
      host -
      port -
      Returns:
      a new SocketEndPoint that will connect to the default slot on the given port on the given host
      Throws:
      RuntimeException - if the given port is not in [0, 65535]
    • toHostAndPortAndSlot

      public static SocketEndPoint toHostAndPortAndSlot(String host, int port, String slot)
      Parameters:
      host -
      port -
      slot -
      Returns:
      a new SocketEndPoint that will connect to the given slot on the given port on the given host
      Throws:
      RuntimeException - if the given port is not in [0, 65535]
      RuntimeException - if the given slot is null
      RuntimeException - if the given slot is blank
    • toLocalHostAndPortAndDefaultSlot

      public static SocketEndPoint toLocalHostAndPortAndDefaultSlot(int port)
      Parameters:
      port -
      Returns:
      a new SocketEndPoint that will connect to the default slot on the given port on the locale machine
      Throws:
      RuntimeException - if the given port is not in [0, 65535]
    • toLocalHostAndPortAndSlot

      public static SocketEndPoint toLocalHostAndPortAndSlot(int port, String slot)
      Parameters:
      port -
      slot -
      Returns:
      a new SocketEndPoint that will connect to the given slot on the given port on the local machine
      Throws:
      RuntimeException - if the given port is not in [0, 65535]
      RuntimeException - if the given slot slot null or blank
    • withSocketAndSocketInputStreamAndSocketOutputStream

      public static SocketEndPoint withSocketAndSocketInputStreamAndSocketOutputStream(Socket socket, InputStream socketInputStream, OutputStream socketOutputStream)
      Parameters:
      socket -
      socketInputStream -
      socketOutputStream -
      Returns:
      a new AbstractNetEndPoint with the given socket. The given socketInputStream and the given socketOutputStream belong to the given socket
      Throws:
      RuntimeException - if the given socket is null
      RuntimeException - if the given socketInputStream is null
      RuntimeException - if the given socketOutputStream is null
    • withSocketAndSocketInputStreamAndSocketOutputStreamAndSlot

      public static SocketEndPoint withSocketAndSocketInputStreamAndSocketOutputStreamAndSlot(Socket socket, InputStream socketInputStream, OutputStream socketOutputStream, String slot)
      Parameters:
      socket -
      socketInputStream -
      socketOutputStream -
      slot -
      Returns:
      a new AbstractNetEndPoint with the given socket and slot. The given socketInputStream and the given socketOutputStream belong to the given socket
      Throws:
      RuntimeException - if the given socket is null
      RuntimeException - if the given socketInputStream is null
      RuntimeException - if the given socketOutputStream is null
      RuntimeException - if the given slot is null or blank
    • getPeerType

      public PeerType getPeerType()
    • getConnectionType

      public ConnectionType getConnectionType()
      Returns:
      the ConnectionType of the current ConnectionTypeHolder
    • getSecurityMode

      public SecurityMode getSecurityMode()
      Returns:
      the SecurityMode of the current SecurityModeHolder
    • noteClose

      public void noteClose()
      Lets the current GroupCloseable note a close.