Request request = new Request(null);
request.setType(Type.CON);
request.setToken(new byte[0]);
request.setURI(uri);
request.send().waitForResponse(5000);
request.cancel();
return request.isRejected();
} catch (InterruptedException e) {
// waiting was interrupted, which is fine
}
return false;