public void enqueue(TextCommand response) {
   long requestId = response.getRequestId();
   if (requestId == -1) {
     connection.getWriteHandler().enqueueSocketWritable(response);
   } else {
     if (currentRequestId == requestId) {
       connection.getWriteHandler().enqueueSocketWritable(response);
       currentRequestId++;
       processWaitingResponses();
     } else {
       responses.put(requestId, response);
     }
   }
 }
 private void processWaitingResponses() {
   TextCommand response = responses.remove(currentRequestId);
   while (response != null) {
     connection.getWriteHandler().enqueueSocketWritable(response);
     currentRequestId++;
     response = responses.remove(currentRequestId);
   }
 }