public String debug(TcpIpConnectionManager connectionManager) {
    StringBuffer sb = new StringBuffer();
    sb.append("in selectors\n");
    for (InSelectorImpl in : connectionManager.getInSelectors()) {
      sb.append(in + " :" + in.getReadEvents() + "\n");

      for (TcpIpConnection connection : connectionManager.getActiveConnections()) {
        ReadHandler readHandler = connection.getReadHandler();
        if (readHandler.getOwner() == in) {
          sb.append("\t" + readHandler + " eventCount:" + readHandler.getEventCount() + "\n");
        }
      }
    }
    sb.append("out selectors\n");
    for (OutSelectorImpl in : connectionManager.getOutSelectors()) {
      sb.append(in + " :" + in.getWriteEvents() + "\n");

      for (TcpIpConnection connection : connectionManager.getActiveConnections()) {
        WriteHandler writeHandler = connection.getWriteHandler();
        if (writeHandler.getOwner() == in) {
          sb.append("\t" + writeHandler + " eventCount:" + writeHandler.getEventCount() + "\n");
        }
      }
    }

    return sb.toString();
  }
 private Map<IOSelector, Set<MigratableHandler>> getHandlersPerSelector(
     TcpIpConnectionManager connectionManager) {
   Map<IOSelector, Set<MigratableHandler>> handlersPerSelector =
       new HashMap<IOSelector, Set<MigratableHandler>>();
   for (TcpIpConnection connection : connectionManager.getActiveConnections()) {
     add(handlersPerSelector, connection.getReadHandler());
     add(handlersPerSelector, connection.getWriteHandler());
   }
   return handlersPerSelector;
 }