public class DTLSClient extends Object
Constructor and Description |
---|
DTLSClient(String privateKey,
String certificate,
String... trustedCertificates)
Instantiate a DTLSClient with default DTLSv1.2 protocol.
|
DTLSClient(String protocol,
String privateKey,
String certificate,
String... trustedCertificates) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
DTLSContext |
getContext() |
DTLSSocket |
getSocket() |
void |
openConnection(String serverAdress,
int port)
Create a socket connected to the provided address and port.
|
String |
receive() |
void |
send(DatagramPacket datagramPacket) |
void |
send(String message) |
public DTLSClient(String privateKey, String certificate, String... trustedCertificates) throws IOException, GeneralSecurityException
privateKey
- of the client.certificate
- of the client.trustedCertificates
- by the client.GeneralSecurityException
- if an exception occurred while creating the SSL context.IOException
public DTLSClient(String protocol, String privateKey, String certificate, String... trustedCertificates) throws IOException, GeneralSecurityException
protocol
- of the client.privateKey
- of the client.certificate
- of the client.trustedCertificates
- by the client.GeneralSecurityException
- if an exception occurred while creating the SSL context.IOException
public void close()
public DTLSContext getContext()
public DTLSSocket getSocket()
public void openConnection(String serverAdress, int port) throws IOException
serverAddress
- port
- IOException
public String receive() throws IOException
IOException
public void send(DatagramPacket datagramPacket) throws IOException
IOException
public void send(String message) throws IOException
IOException