Class SocketCommProps

All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable
Direct Known Subclasses:
TelnetCommProps, WebSocketCommProps

public class SocketCommProps extends PropCnr
This property container contains all properties required for a Socket (NIO) connection using Proxy, WebSocket, SSL, etc, required by the SocketProp property.
Author:
Christopher Mindus
  • Constructor Details Link icon

    • SocketCommProps Link icon

      public SocketCommProps()
      Creates the socket property container without a name. The name must be set in all cases using the setPropertyAtom call.
    • SocketCommProps Link icon

      public SocketCommProps(Atom propertyAtom)
      Creates the socket property container with the specified name. All system-reserved names for components begins with "$".
      Parameters:
      propertyAtom - the name of the component, unique within it's parent.
  • Method Details Link icon

    • clone Link icon

      public SocketCommProps clone()
      Clone method overridden in order not to clone the proxy password.
      Overrides:
      clone in class PropCnr
    • setVerbose Link icon

      public void setVerbose(boolean on)
      Sets verbose mode.
      Parameters:
      on - true for verbose mode, false for silent.
    • isVerbose Link icon

      public boolean isVerbose()
      Checks for verbose output.
      Returns:
      true for verbose output, false for silent.
    • getHost Link icon

      public String getHost()
      Gets the destination host name or IP address for the socket destination.
      Returns:
      null if none is set.
    • getPort Link icon

      public int getPort()
      Gets the host port for the socket.
      Returns:
      0 if none if set.
    • getBindAddress Link icon

      public String getBindAddress()
      Gets the bind address for the port, i.e. the local host name or IP address.
      Returns:
      null if none is set or not required.
    • isSecure Link icon

      public boolean isSecure()
      Gets the secure socket flag.
      Returns:
      true if SSL-secured, false if not.
    • setSecure Link icon

      public void setSecure(boolean on)
      Sets the secure socket flag.
    • getProxyHost Link icon

      public String getProxyHost()
      Gets the proxy host name if any.
      Returns:
      null for no proxy, otherwise a host name or IP address.
    • getProxyPort Link icon

      public int getProxyPort()
      Gets the proxy port if any.
      Returns:
      0 for no proxy.
    • getProxyType Link icon

      public int getProxyType()
      Gets the proxy type: 0=none/DIRECT, 1=HTTP, 2=SOCKS 4/5.
    • useWebSocket Link icon

      public boolean useWebSocket()
      Checks if WebSocket protocol is used.
      Returns:
      true if WebSocket is used, false otherwise.
    • getProxyUser Link icon

      public String getProxyUser()
      Gets the authentication user name for HTTP proxy if required.
      Returns:
      null for none, otherwise a user name.
    • getProxyPW Link icon

      public String getProxyPW()
      Gets the authentication password for HTTP proxy if required.
      Returns:
      null for none, otherwise a password for the user name in question.
    • setHost Link icon

      public void setHost(String host)
      Sets the destination host name/IP address for the socket.
      Parameters:
      host - the host name or IP address (IPv4 or IPv6).
      Throws:
      NullPointerException - if the parameter is null.
    • setPort Link icon

      public void setPort(int port)
      Gets the host port for the socket.
      Parameters:
      port - the port number 1-65535.
      Throws:
      IllegalArgumentException - if the port is not 1-65535.
    • setBindAddress Link icon

      public void setBindAddress(String bindAddress)
      Sets the bind address for the socket, i.e. the local host name or IP address.
      Parameters:
      bindAddress - The bind address as host name or IP address (IPv4 or IPv6).
    • setSecureProps Link icon

      public void setSecureProps(SSLCommProps secureProps) throws PropException
      Sets or removed the secure properties.
      Parameters:
      secureProps - The secure properties, or null to remove them.
      Throws:
      PropException - If the properties couldn't be added, set or removed.
    • getSecureProps Link icon

      public SSLCommProps getSecureProps() throws PropException
      Gets the secure properties.To check for secure communication, use isSecure().
      Returns:
      The instance of the secure properties, null if not secure.
      Throws:
      PropException - If the secure properties couldn't be added.
    • createSecureProps Link icon

      public SSLCommProps createSecureProps() throws PropException
      Creates or gets the secure properties. If the no secure properties are present, a new instance is created.
      Returns:
      The instance of the secure properties.
      Throws:
      PropException - If the secure properties couldn't be added.
    • setProxyHost Link icon

      public void setProxyHost(String proxyHost)
      Sets the proxy host name if any.
      Parameters:
      proxyHost - The proxy host name or IP address.
    • setProxyPort Link icon

      public void setProxyPort(int proxyPort)
      Sets the proxy port if any.
      Parameters:
      proxyPort - 0 for no proxy, otherwise 1-65535.
      Throws:
      IllegalArgumentException - if the proxyPort is not 0-65535.
    • setProxyType Link icon

      public void setProxyType(int proxyType)
      Sets the proxy type: 0=none/DIRECT, 1=HTTP, 2=SOCKS 4/5.
      Parameters:
      proxyType - 0=none/DIRECT, 1=HTTP, 2=SOCKS 4/5.
      Throws:
      IllegalArgumentException - if the proxyType is not 0-2.
    • setWebSocket Link icon

      public void setWebSocket(boolean webSocket)
      Sets if WebSocket protocol is used.
      Parameters:
      webSocket - true if WebSocket is used, false otherwise.
    • setProxyUser Link icon

      public void setProxyUser(String proxyUser)
      Gets the authentication user name for HTTP proxy if required.
      Parameters:
      proxyUser - The user name.
    • getProxyPW Link icon

      public void getProxyPW(String password)
      Sets the authentication password for HTTP proxy if required. This password is not stored for persistence nor transmitted if the class instance is cloned or transmitted in transactions.
      Parameters:
      password - null for none, otherwise a password for the user name in question.
    • setResolveHostNames Link icon

      public void setResolveHostNames(boolean doResolveHostNames)
      Sets if host name resolve is enabled or if the host address should be returned (for performance reasons) for a call to e.g. getRemoteHost().
      Parameters:
      doResolveHostNames - true if host names should be resolved, default is false.
    • doResolveHostNames Link icon

      public boolean doResolveHostNames()
      Checks if host name resolve is enabled or if the host address should be returned (for performance reasons) for a call to e.g. getRemoteHost().
      Returns:
      true if host names should be resolved, default is false.