CoapClient

- Added new constructor `this(string host, ushort port)`
-This constructor provided name resolution on the host part.

Client (unit tests)

- Updated unit test to use the new `CoapClient` name-resolution-based constructor
This commit is contained in:
Tristan B. Velloza Kildaire 2023-09-14 17:05:44 +02:00
parent 456d8918ee
commit 1e50540e75

View File

@ -60,6 +60,22 @@ public class CoapClient
init();
}
/**
* Constructs a new CoAP client to the
* provided endpoint address and port.
*
* This constructor provided name
* resolution on the host part.
*
* Params:
* host = the CoAP host
* port = the CoAP port
*/
this(string host, ushort port)
{
this(new InternetAddress(host, port));
}
/**
* Sets up a new datagram socket,
* sets the running status to `true`
@ -241,8 +257,7 @@ version(unittest)
*/
unittest
{
Address addr = new InternetAddress("coap.me", 5683);
CoapClient client = new CoapClient(addr);
CoapClient client = new CoapClient("coap.me", 5683);
CoapRequestFuture future = client.newRequestBuilder().payload(cast(ubyte[])"Hello this is Tristan!")