@Test
public void test() throws Exception {

    srv.addRequestHandler("/test", new ReadOnlyCoapResource("11"));
    assertEquals("11", cli.resource("/test").get().get().getPayloadString());
    srv.addRequestHandler("/test2", new ReadOnlyCoapResource("22", "", 61));
    assertEquals("22", cli.resource("/test2").get().get().getPayloadString());
    assertEquals(61, cli.resource("/test2").get().get().headers().getMaxAgeValue());
    srv.addRequestHandler("/test3", new ReadOnlyCoapResource("33", "", MediaTypes.CT_TEXT_PLAIN, -1));
    assertEquals("33", cli.resource("/test3").get().get().getPayloadString());
    assertEquals(MediaTypes.CT_TEXT_PLAIN, cli.resource("/test3").get().get().headers().getContentFormat().shortValue());
}