public void doGet(HttpServletRequest aRequest, HttpServletResponse aResponse) {
    String theInput = aRequest.getParameter("input");
    String theSession = aRequest.getParameter("session");
    String thePeerId = aRequest.getParameter("peerid");

    LOGGER.debug(
        "Received message from peer '"
            + thePeerId
            + "' in session '"
            + theSession
            + "': "
            + theInput
            + "'"
            + " at remote ip '"
            + aRequest.getRemoteAddr()
            + "'");
    // TODO remove when logging correctly enabled on server
    //    System.out.println("Received message from peer '" + thePeerId + "' in session '" +
    // theSession + "': " + theInput + "'" );

    try {
      //			LOGGER.debug( "Concurrent requests in ProtocolServlet: "  +
      // myConcurrentRequestCounter.incrementAndGet());

      if (theSession != null && !"".equals(theSession)) {
        String theURL = aRequest.getRequestURL().toString();
        theURL = theURL.substring(0, theURL.indexOf("/", 7) + 1);
        getSessionData().putProperty(theSession, "requestor.ip", aRequest.getRemoteAddr());
        getSessionData()
            .putProperty(
                theSession,
                ProtocolServer.NETWORK_INTERFACE,
                HttpCommunicationInterface.getInstance());
        //				getSessionData().putProperty(theSession, "requestor.url", theURL);
        //				LOGGER.debug("Remote ip '" + getSessionData().getProperty(theSession, "requestor.ip")
        // + "'");
        //				LOGGER.debug("Remote url '" + getSessionData().getProperty(theSession,
        // "requestor.url") + "'");
      }

      if ("exchange".equalsIgnoreCase(theInput)) {
        ((RoutingProtocol) getProtocolContainer().getProtocol(RoutingProtocol.ID))
            .exchangeRoutingTable();
      } else if (theInput == null || "".equals(theInput)) {
        printDebugInfo(aRequest, aResponse, theSession);
      } else {
        getPeerIpMap().put(thePeerId, aRequest.getRemoteAddr());

        String theResult = getProtocolContainer().handleCommand(theSession, theInput);
        aResponse.getWriter().println(theResult);
      }
    } catch (Exception e) {
      LOGGER.error("could not send response message ", e);
    } finally {
      // remove the session data
      getSessionData().clearSessionData(theSession);
      myConcurrentRequestCounter.decrementAndGet();
    }
  }
  public PeerSenderReply sendMessageTo(
      AbstractPeer aSendingPeer, WebPeer aWebPeer, String aMessage, int aTimeoutInSeconds)
      throws IOException {
    //    synchronized (aWebPeer.getPeerId()) {

    //      long t1 = System.currentTimeMillis();
    //      LOGGER.debug("Entering peer to web sender for message '" + aMessage + "' logcounter: " +
    // LOGCOUNTER++);
    //    AbstractURLConnectionHelper theConnectionHelper = new ApacheURLConnectionHelper( new
    // URL(aWebPeer.getURL(), ProtocolWebServer.CONTEXT_PROTOCOL), true );
    AbstractURLConnectionHelper theConnectionHelper =
        new URLConnectionHelper(
            new URL(aWebPeer.getURL(), ProtocolWebServer.CONTEXT_PROTOCOL), true);
    theConnectionHelper.scheduleClose(30, TimeUnit.SECONDS);
    try {
      theConnectionHelper.connectInputOutput();
      //        long t2 = System.currentTimeMillis();
      //        LOGGER.debug("Connecting to '" + aWebPeer.getURL()  + "' took " + (t2 - t1) + "
      // ms");
      theConnectionHelper.write("session", UUID.randomUUID().toString());
      theConnectionHelper.write("peerid", aSendingPeer.getPeerId());
      //      theConnectionHelper.write( "input", aMessage );
      theConnectionHelper.write("input", URLEncoder.encode(aMessage, "UTF-8"));
      //        long t3 = System.currentTimeMillis();
      //        LOGGER.debug("Writing to outputstream of '" + aWebPeer.getURL() + "' took " +
      // (t3-t2) +  " ms");
      //      theConnectionHelper.endLine();
      //      theConnectionHelper.flush();
      theConnectionHelper.endInput();
      String theLine = theConnectionHelper.readLine();
      //        long t4 = System.currentTimeMillis();
      //        LOGGER.debug("Reading from '" + aWebPeer.getURL()  + "' took " + (t4-t3) +  " ms");

      return new PeerSenderReply(theLine, HttpCommunicationInterface.getInstance());
    } catch (IOException e) {
      LOGGER.error(
          "Could not send message to web peer at endpoint: '"
              + aWebPeer.getEndPointRepresentation()
              + "'",
          e);
      // LOGGER.error("Could not send message to web peer at endpoint: '" +
      // aWebPeer.getEndPointRepresentation() + "'");
      throw e;
    } finally {
      theConnectionHelper.close();
    }
  }