Interface Connector

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Connector
Defines a function which is called whenever client-side socket connections need to be established.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called to establish a new socket connection using the session's remote address.
    static Connector
    Returns a default connector that directly connects sockets.
    static Connector
    Returns a connector that doesn't establish remote connections, but instead pipes communication directly to accepted sessions of the given environment.
    static Connector
    secure(SSLContext context)
    Returns a connector that directly connects sockets over TLS/SSL.
  • Method Details

    • direct

      static Connector direct()
      Returns a default connector that directly connects sockets.
    • secure

      static Connector secure(SSLContext context)
      Returns a connector that directly connects sockets over TLS/SSL.
      Parameters:
      context - can pass null to use the default
    • local

      static Connector local(Environment env)
      Returns a connector that doesn't establish remote connections, but instead pipes communication directly to accepted sessions of the given environment. This type of connector is mostly useful for testing purposes. Note that it completely ignores socket addresses, and so a null SocketAddress can be passed to the connect method.
    • connect

      void connect(Session<?> s) throws IOException
      Called to establish a new socket connection using the session's remote address. Once established, pass the socket to one of the session's connected methods. This method can be called by multiple threads concurrently.
      Throws:
      IOException