Package net.dona.doip.client.transport
Class TransportDoipClient
java.lang.Object
net.dona.doip.client.transport.TransportDoipClient
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes all connections.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.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.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.connect
(ConnectionOptions options) Connect to a server using the specified connection options.
-
Constructor Details
-
TransportDoipClient
public TransportDoipClient()
-
-
Method Details
-
connect
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
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 serverclientKeyManager
- 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 interfaceAutoCloseable
-