### Question:
CoapClient implements Closeable { public CompletableFuture<CoapPacket> ping() throws CoapException { FutureCallbackAdapter<CoapPacket> callback = new FutureCallbackAdapter<>(); coapServer.ping(destination, callback); return callback; } CoapClient(InetSocketAddress destination, CoapServer coapServer); CoapRequestTarget resource(String path); CompletableFuture<CoapPacket> ping(); void ping(Callback<CoapPacket> callback); @Override void close();  }### Answer:
@Test public void pingRequest() throws Exception { CompletableFuture<CoapPacket> resp = client.ping(); assertSent(newCoapPacket(LOCAL_5683).mid(100).con()); cliReceive(newCoapPacket(LOCAL_5683).emptyAck(100)); assertNotNull(resp.get()); }
@Test public void pingRequest2() throws Exception { FutureCallbackAdapter<CoapPacket> resp = new FutureCallbackAdapter<>(); client.ping(resp); cliReceive(newCoapPacket(LOCAL_5683).emptyAck(100)); assertNotNull(resp.get()); }