public void listenUDP(EndPoint localEp) {
   UdpConnection connection = new UdpConnection();
   logger_.debug("Starting to listen on " + localEp);
   try {
     connection.init(localEp.getPort());
     endPoints_.add(localEp);
   } catch (IOException e) {
     logger_.warn(LogUtil.throwableToString(e));
   }
 }
  public void deregisterAllVerbHandlers(EndPoint localEndPoint) {
    Iterator keys = verbHandlers_.keySet().iterator();
    String key = null;

    /*
     * endpoint specific verbhandlers can be distinguished because
     * their key's contain the name of the endpoint.
     */
    while (keys.hasNext()) {
      key = (String) keys.next();
      if (key.contains(localEndPoint.toString())) keys.remove();
    }
  }
  public void listen(EndPoint localEp, boolean isHttp) throws IOException {
    ServerSocketChannel serverChannel = ServerSocketChannel.open();
    ServerSocket ss = serverChannel.socket();
    ss.bind(localEp.getInetAddress());
    serverChannel.configureBlocking(false);

    SelectionKeyHandler handler = null;
    if (isHttp) {
      handler = new HttpConnectionHandler();
    } else {
      handler = new TcpConnectionHandler(localEp);
    }

    SelectionKey key =
        SelectorManager.getSelectorManager()
            .register(serverChannel, handler, SelectionKey.OP_ACCEPT);
    endPoints_.add(localEp);
    listenSockets_.put(localEp, key);
  }