Coap.close()

DESCRIPTION

Releases any resources associated with the CoAP instance. This method is called automatically at the end of a try-with-resources block, which helps to ensure that resources are released promptly and reliably.

Example of using a CoAP object within a try-with-resources statement:

try (Coap coap = connection.createCoap(...)) {
// ... use coap
}

With this setup, {@code close()} will be called automatically on {@code coap} at the end of the block, releasing any underlying native Nabto Client SDK resources without any further action required on the application.

If the try-with-resources construct is not feasible, the application must manually call close() when the CoAP instance is no longer needed.</p>

Unlike the {@link AutoCloseable#close()} method, this {@code close()} method does not throw any exceptions.

DECLARATION

    @Override
    void close()