Package net.dona.doip.client.transport

# Class TransportDoipClient

java.lang.Object
net.dona.doip.client.transport.TransportDoipClient

All Implemented Interfaces:
  `AutoCloseable`

public class TransportDoipClient extends Object implements AutoCloseable
A DOIP client close to the transport protocol. It can connect to DOIP servers yielding instances of `DoipConnection` which are used to communicate with the server. The user can call `close()` to close all connections.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TransportDoipClient()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Closes all connections.
  `DoipConnection`
  `connect(InetAddress address, int port)`
  Connects to a server by specifying an IP address and port, using default timeouts of one minute, trusting any provided server certificate, and not supplying a client certificate.
  `DoipConnection`
  `connect(InetAddress address, int port, int connectTimeoutMs, int readTimeoutMs)`
  Connects to a server by specifying an IP address and port, using the specified timeouts, trusting any provided server certificate, and not supplying a client certificate.
  `DoipConnection`
  `connect(InetAddress address, int port, X509TrustManager serverTrustManager, X509KeyManager clientKeyManager, int connectTimeoutMs, int readTimeoutMs)`
  Connects to a server by specifying an IP address and port, using the specified timeouts, trusting server certificates according to the specified trust manager, and providing a client certificate using the specified key manager.
  `DoipConnection`
  `connect(ConnectionOptions options)`
  Connect to a server using the specified connection options.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TransportDoipClient

    public TransportDoipClient()

- ## Method Details

  - ### connect

    public DoipConnection connect(InetAddress address, int port) throws IOException
    Connects to a server by specifying an IP address and port, using default timeouts of one minute, trusting any provided server certificate, and not supplying a client certificate.
    Returns:
      a DOIP connection for communicating with the specified server
    Throws:
      `IOException`

  - ### connect

    public DoipConnection connect(InetAddress address, int port, int connectTimeoutMs, int readTimeoutMs) throws IOException
    Connects to a server by specifying an IP address and port, using the specified timeouts, trusting any provided server certificate, and not supplying a client certificate.
    Returns:
      a DOIP connection for communicating with the specified server
    Throws:
      `IOException`

  - ### connect

    public DoipConnection connect(ConnectionOptions options) throws IOException
    Connect to a server using the specified connection options.
    Returns:
      a DOIP connection for communicating with the specified server
    Throws:
      `IOException`

  - ### connect

    public DoipConnection connect(InetAddress address, int port, X509TrustManager serverTrustManager, X509KeyManager clientKeyManager, int connectTimeoutMs, int readTimeoutMs) throws IOException
    Connects to a server by specifying an IP address and port, using the specified timeouts, trusting server certificates according to the specified trust manager, and providing a client certificate using the specified key manager.
    Parameters:
      `serverTrustManager` - a trust manager defining which server certificates to trust; if null trust every server
      `clientKeyManager` - a key manager defining which client certificate to provide; if null provide no client certificate
    Returns:
      a DOIP connection for communicating with the specified server
    Throws:
      `IOException`

  - ### close

    public void close()
    Closes all connections.
    Specified by:
      `close` in interface `AutoCloseable`