request.setPayload(payload);
request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN);
if (request.getScheme().equals(CoAP.COAP_SECURE_URI_SCHEME)) {
dtlsEndpoint = new CoAPEndpoint(new DTLSConnector(new InetSocketAddress(0)), NetworkConfig.getStandard());
dtlsEndpoint.setMessageDeliverer(new ClientMessageDeliverer());
dtlsEndpoint.start();
EndpointManager.getEndpointManager().setDefaultSecureEndpoint(dtlsEndpoint);
}
// execute request