@Test
public void sendError_when_exceptionWhileHandlingRequest() throws Exception {

    server.addRequestHandler("/err", exchange -> {
        throw new CoapException("error-007");
    });
    server.coapRequestHandler.handleRequest(newCoapPacket(LOCAL_1_5683).mid(1).con().post().uriPath("/err").build(), TransportContext.NULL);
    assertSendResponse(newCoapPacket(LOCAL_1_5683).mid(1).ack(Code.C500_INTERNAL_SERVER_ERROR));
}