Exemplo n.º 1
0
 @Override
 public void sendResponse(Exchange exchange, Response response) {
   // A response must have the same token as the request it belongs to. If
   // the token is empty, we must use a byte array of length 0.
   if (response.getToken() == null) {
     LOGGER.fine(
         "Set token from current request: "
             + Utils.toHexString(exchange.getCurrentRequest().getToken()));
     response.setToken(exchange.getCurrentRequest().getToken());
   }
   super.sendResponse(exchange, response);
 }
Exemplo n.º 2
0
 @Override
 public void receiveRequest(Exchange exchange, Request request) {
   if (exchange.getCurrentRequest().getToken() == null)
     throw new NullPointerException(
         "Received requests's token cannot be null, use byte[0] for empty tokens");
   super.receiveRequest(exchange, request);
 }