@Test
public void receiveObservationCancellation_withCode() throws Exception {

    ObservationHandler observationHandler = mock(ObservationHandler.class);
    server.setObservationHandler(observationHandler);
    server.coapRequestHandler.handleObservation(newCoapPacket(LOCAL_5683).con(Code.C404_NOT_FOUND).obs(0).token(33).payload("A").mid(2).build(), TransportContext.NULL);
    verify(observationHandler).callException(isA(ObservationTerminatedException.class));
    //ack response
    assertSendResponse(newCoapPacket(LOCAL_5683).emptyAck(2));
}