@Test
public void observation_failWhileHandling2() throws Exception {

    ObservationListener obsListener = mock(ObservationListener.class);
    CompletableFuture<CoapPacket> resp = client.resource("/test").token(1001).observe(obsListener);
    cliReceive(newCoapPacket(LOCAL_5683).mid(100).token(1001).obs(1).payload("1").ack(Code.C205_CONTENT));
    assertEquals("1", resp.get().getPayloadString());
    //observation
    reset(coapTransport);
    doThrow(new CoapException(""))
            .when(obsListener).onObservation(any());
    cliReceive(newCoapPacket(LOCAL_5683).mid(200).token(1001).obs(2).payload("2").con(Code.C205_CONTENT));
    assertSent(newCoapPacket(LOCAL_5683).mid(200).ack(Code.C500_INTERNAL_SERVER_ERROR));
}