示例#1
0
    @Override
    public final void run() {
      try {
        final TcpPipe enclosing = TcpPipe.this;
        Log.log("startup send endpoint for %s @ ", enclosing, soport);

        Socket so = new Socket();
        so.setKeepAlive(true);
        so.setPerformancePreferences(SO_CONNTIME_PREF, SO_LATENCY_PREF, SO_BANDWIDTH_PREF);
        so.setTcpNoDelay(true);
        so.setSendBufferSize(SO_SND_BUFF_SIZE);

        Log.log("... connecting to port %d", soport);
        final InetAddress localhost = InetAddress.getLocalHost();
        SocketAddress endpoint = new InetSocketAddress(localhost, soport);

        so.connect(endpoint);
        Log.log("client connected to %s", so.getRemoteSocketAddress());

        if (!sndsocket_ref.compareAndSet(null, so))
          throw new IllegalStateException("sendInUpdater");

        Log.log("-- SND endpoint connected to remote endpoint %s", so.getRemoteSocketAddress());

      } catch (Exception e) {
        throw new RuntimeException("SND bootstrap failed", e);
      } finally {
        Log.log("SND endpoint established");
      }
    }
  /**
   * Certificate_Verify(証明書)を受け取ったときの動作をします。
   *
   * @param line クライアントから受信した文字列
   * @return クライアントの証明書の真偽
   * @author kinbara
   */
  private boolean recieveCertificateVerify(String line) {
    boolean cert_verify = false;
    // サーバー側のダイジェストのハッシュ値
    ListIterator listIte = netDigest.listIterator();
    String digest = "";
    while (listIte.hasNext()) {
      digest += listIte.next().toString();
    }
    digest = digest.substring(0, digest.indexOf("Certificate_Verify"));
    BigInteger digest1 = new BigInteger(this.getHash(digest), 16);
    // クライアントの公開鍵で復号
    BigInteger digest2 = new BigInteger(line.substring(line.indexOf(":") + 1), 16);
    try {
      X509 x509 = new X509("src/sglserver/conf/key/ca", "CAKeyStore", this.storePasswd);
      // TODO:(注意)ユーザーの公開鍵をpeerNameでCAKeyStoreに登録している場合のみ有効
      RSAPublicKey pk = x509.getRSAPublicKey(peerName);
      digest2 = digest2.modPow(pk.getPublicExponent(), pk.getModulus()); // 復号
      // b = a.modPow(s, n); → a mod n のs乗がbに代入される
      // pk.getPublicExponent()→公開指数
      // pk.getModulus()→pkのmod値
    } catch (Exception e) {

      e.printStackTrace();
    }
    if (digest1.compareTo(digest2) == 0) {
      System.out.println(socket.getRemoteSocketAddress() + "は、信頼できます。");
      cert_verify = true;
    } else {
      System.out.println(socket.getRemoteSocketAddress() + "は、危険です。");
    }
    return (cert_verify);
  }
示例#3
0
 public Relay(Socket inSocket, Socket outSocket, boolean isResponse) throws IOException {
   this.inSocket = inSocket;
   this.in = inSocket.getInputStream();
   this.out = outSocket.getOutputStream();
   if (isResponse) {
     connectionSpec =
         outSocket.getRemoteSocketAddress() + " <- " + inSocket.getRemoteSocketAddress();
   } else {
     connectionSpec =
         inSocket.getRemoteSocketAddress() + " -> " + outSocket.getRemoteSocketAddress();
   }
 }
示例#4
0
 public String getRemoteAddress() {
   if (socket != null) {
     SocketAddress address = socket.getRemoteSocketAddress();
     if (address instanceof InetSocketAddress) {
       return "tcp://"
           + ((InetSocketAddress) address).getAddress().getHostAddress()
           + ":"
           + ((InetSocketAddress) address).getPort();
     } else {
       return "" + socket.getRemoteSocketAddress();
     }
   }
   return null;
 }
  public void run() throws IOException {
    synchronized (this) {
      if (serverSocket == null) {
        serverSocket = new ServerSocket(addr.getPort(), 0, addr.getAddress());
      } else {
        System.err.println("ERROR: Duplicate running of the same server object.");
        return;
      }
    }
    final Substitutor3000 substitutor = new Substitutor3000();

    //noinspection InfiniteLoopStatement
    while (shouldRun) {
      final Socket clientSocket;

      try {
        clientSocket = serverSocket.accept();
      } catch (IOException ex) {
        System.err.println(
            "ERROR: An I/O error occurs when waiting for a connection: " + ex.getMessage() + ".");
        continue;
      } catch (SecurityException ex) {
        System.err.println(
            "ERROR: Security manager doesn't allow to open the connection: "
                + ex.getMessage()
                + ".");
        continue;
      }
      System.out.println(
          "INFO: Connection with " + clientSocket.getRemoteSocketAddress() + " is established.");

      new Thread(new ConnectionHandler(clientSocket, substitutor)).start();
    }
  }
示例#6
0
  public void run() {
    while (true) {
      try {
        System.out.println("Server name: " + serverSocket.getInetAddress().getHostName());
        System.out.println("Waiting for client on port " + serverSocket.getLocalPort() + "...");
        Socket server = serverSocket.accept();
        System.out.println("Just connected to " + server.getRemoteSocketAddress());

        ObjectInputStream objectIn = new ObjectInputStream(server.getInputStream());

        try {
          Recipe rec = (Recipe) objectIn.readObject();
          startHMI(rec, rec.getProductName());

          //				System.out.println("Object Received: width: "+rec.getWidth()+" height:
          // "+rec.getHeight());
        } catch (ClassNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

        DataOutputStream out = new DataOutputStream(server.getOutputStream());
        out.writeUTF(
            "Thank you for connecting to " + server.getLocalSocketAddress() + "\nGoodbye!");
        server.close();
      } catch (SocketTimeoutException s) {
        System.out.println("Socket timed out!");
        break;
      } catch (IOException e) {
        e.printStackTrace();
        break;
      }
    }
  }
  public static void main(String args[]) throws Exception {

    int port = 9001; // Receiving Port

    ServerSocket servSock = new ServerSocket(port);
    // Change Bin to Text on both client and server for different encoding
    VoteMsgCoder coder = new VoteMsgBinCoder();
    VoteService service = new VoteService();

    while (true) {
      Socket clntSock = servSock.accept();
      System.out.println("Handling client at " + clntSock.getRemoteSocketAddress());
      // Change Length to Delim for a different framing strategy
      Framer framer = new LengthFramer(clntSock.getInputStream());
      try {
        byte[] req;
        while ((req = framer.nextMsg()) != null) {
          System.out.println("Received message (" + req.length + " bytes)");
          VoteMsg responseMsg = service.handleRequest(coder.fromWire(req));
          framer.frameMsg(coder.toWire(responseMsg), clntSock.getOutputStream());
        }
      } catch (IOException ioe) {
        System.err.println("Error handling client: " + ioe.getMessage());
      } finally {
        System.out.println("Closing connection");
        clntSock.close();
      }
    }
  }
示例#8
0
  public void executa() {
    try {
      cliente = new Socket(this.host, Servidor.serverPort);
      System.out.println(
          "PortaLocal do socket: "
              + cliente.getLocalPort()
              + "\nPorta conectada: "
              + cliente.getPort()
              + "\nLocalSocketAddress: "
              + cliente.getLocalSocketAddress()
              + "\nInetAddress: "
              + cliente.getInetAddress()
              + "\nRemoteSocketAddress: "
              + cliente.getRemoteSocketAddress());
      System.out.println("Cliente conectado!");
      System.out.println("testes");

      // thread para receber mensagens do servidor
      ImpressoraCliente r = new ImpressoraCliente(cliente.getInputStream());
      new Thread(r).start();

      conectado = true;
      mainWindow.conectado(this);
      // cliente.close();

    } catch (IOException e) {
      mainWindow.getTextConsole().setText("Não foi possível se conectar ao servidor.");
      conectado = false;
      System.err.println(e.getMessage());
    }
  }
示例#9
0
  @Override
  public void run() {
    try {
      // Init socket
      serverSocket = new ServerSocket(portNumber);
      serverSocket.setSoTimeout(Configuration.SOCKET_WAIT_TIMEOUT);

      while (_continue) {
        try {
          // Listen
          socket = serverSocket.accept();
          ois = new ObjectInputStream(socket.getInputStream());
          while (null != (objectReceived = (T) ois.readObject())) {
            String[] parts = socket.getRemoteSocketAddress().toString().replace("/", "").split(":");
            Log.e("omar", "--------------------------------------------------");

            Log.e("omar", parts[0]);
            Log.e("omar", "--------------------------------------------------");

            onConsume.onConsume(objectReceived, parts[0]);
          }
        } catch (SocketTimeoutException | EOFException ex) {
        } catch (NullPointerException ex) {
          ex.printStackTrace();
        }
      }
      socket.close();
    } catch (NullPointerException ex) {
    } catch (IOException | ClassNotFoundException ex) {
      ex.printStackTrace();
    }
  }
  protected void doTask() throws Exception {
    while (stateCheck(STATECHECK_RUNNING)) {
      try {
        Socket client = server.accept();
        if (null != client) {
          ICShell clientShell = new ICShellSocket(client);

          LineProcessor processor;
          if (null != procNode) {
            processor =
                (ICShell.LineProcessor)
                    ICAppFrame.getComponent(procNode, ICShell.LineProcessor.class);
          } else {
            processor =
                new ICShellCmdProcessor(
                    (ICGenCommand) ICAppFrame.getComponent(APP_COMMANDS, ICGenCommand.class));
          }

          clientShell.setProcessor(processor);
          SocketAddress sa = client.getRemoteSocketAddress();
          clientShell.setName(getName() + " client connected from " + sa);
          clientShell.startShell();
        }
      } catch (SocketException ex) {
        // if the accept failed because stopRequested(), we should not throw exception
        if (stateCheck(STATECHECK_RUNNING)) {
          throw ex;
        }
      }
    }
  }
示例#11
0
  @Override
  public void run() {
    while (true) {
      System.out.println(
          "server started .... waiting for client" + "on port no. " + server.getLocalPort());
      // now make server eligible to connect and accept client req
      try {
        Socket socket = server.accept(); // server is now connected
        System.out.println("Just got connected to " + socket.getRemoteSocketAddress());
        // read the client message
        DataInputStream dis = new DataInputStream(socket.getInputStream());
        System.out.println(dis.readUTF());
        // giving response to the client
        DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
        dos.writeUTF(
            "Thank your so much for connecting ..."
                + "to "
                + socket.getLocalSocketAddress()
                + "\n Goodbye Have a nice Day!!!");
        socket.close();

      } catch (IOException e) {
        e.printStackTrace();
        break;
      }
    } // end of while
  } // end of run
  public void run() {
    while (running) {
      try {
        RWSocket clientSocket = new RWSocket(this.server);
        Socket client = this.socket.accept();
        long startTime = date.getTime();
        clientSocket.init(client);
        clientSockets.add(clientSocket);
        long endTime = date.getTime();
        System.out.println(
            "Found Client. Address: "
                + client.getRemoteSocketAddress()
                + " Initialization Took: "
                + (endTime - startTime));
      } catch (SocketTimeoutException e) {

      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    try {
      socket.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
示例#13
0
 public Builder socket(Socket socket) throws IOException {
   return socket(
       socket,
       ((InetSocketAddress) socket.getRemoteSocketAddress()).getHostName(),
       Okio.buffer(Okio.source(socket)),
       Okio.buffer(Okio.sink(socket)));
 }
示例#14
0
  public static void handleEchoClient(Socket clntSock, Logger logger) {
    try {
      InputStream in = clntSock.getInputStream();
      OutputStream out = clntSock.getOutputStream();

      int recvMsgSize;
      int totalBytesEchoed = 0;
      byte[] echoBuffer = new byte[BUFSIZE];

      while ((recvMsgSize = in.read(echoBuffer)) != -1) {
        out.write(echoBuffer, 0, recvMsgSize);
        totalBytesEchoed += recvMsgSize;
      }

      logger.info(
          "Client " + clntSock.getRemoteSocketAddress() + ", echoed " + totalBytesEchoed + "bytes");
    } catch (IOException e) {
      logger.log(Level.WARNING, "Exception in echo protocol", e);
    } finally {
      try {
        clntSock.close();
      } catch (IOException e) {

      }
    }
  }
  @Override
  public void run() {
    try {
      socket = server.accept();
      System.out.println("Download : " + socket.getRemoteSocketAddress());

      In = socket.getInputStream();
      Out = new FileOutputStream(saveTo);

      byte[] buffer = new byte[1024];
      int count;

      while ((count = In.read(buffer)) >= 0) {
        Out.write(buffer, 0, count);
      }

      Out.flush();

      if (Out != null) {
        Out.close();
      }
      if (In != null) {
        In.close();
      }
      if (socket != null) {
        socket.close();
      }
    } catch (Exception ex) {
      System.out.println("Exception [Download : run(...)]");
    }
  }
  @Test
  public void testSocketBind() throws Exception {
    final InetAddress localAddress = InetAddress.getByAddress(new byte[] {127, 0, 0, 1});
    final int localPort = 8888;
    final InetAddress remoteAddress = InetAddress.getByAddress(new byte[] {10, 0, 0, 2});
    final int remotePort = 80;
    final InetSocketAddress localSockAddress = new InetSocketAddress(localAddress, localPort);
    final InetSocketAddress remoteSockAddress = new InetSocketAddress(remoteAddress, remotePort);
    Mockito.when(socket.getLocalSocketAddress()).thenReturn(localSockAddress);
    Mockito.when(socket.getRemoteSocketAddress()).thenReturn(remoteSockAddress);
    Mockito.when(socket.getLocalAddress()).thenReturn(localAddress);
    Mockito.when(socket.getLocalPort()).thenReturn(localPort);
    Mockito.when(socket.getInetAddress()).thenReturn(remoteAddress);
    Mockito.when(socket.getPort()).thenReturn(remotePort);
    conn.bind(socket);

    Assert.assertEquals("127.0.0.1:8888<->10.0.0.2:80", conn.toString());
    Assert.assertTrue(conn.isOpen());
    Assert.assertEquals(8888, conn.getLocalPort());
    Assert.assertEquals(80, conn.getRemotePort());
    Assert.assertEquals(
        InetAddress.getByAddress(new byte[] {127, 0, 0, 1}), conn.getLocalAddress());
    Assert.assertEquals(
        InetAddress.getByAddress(new byte[] {10, 0, 0, 2}), conn.getRemoteAddress());
  }
示例#17
0
 public void run() {
   try {
     BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
     String inString;
     while (sessionIsRunning && (inString = in.readLine()) != null) {
       logger.finer(
           "Received: " + inString + " from " + socket.getRemoteSocketAddress().toString());
       String result = executeCommandLine(inString);
       if (result == null) {
         break;
       }
       result += "\n\r";
       socket.getOutputStream().write(result.getBytes());
       messageCount++;
     }
     socket.close();
   } catch (Exception e) {
     if (sessionIsRunning) {
       logger.warning("Failed reading from socket in TCPCommandPort " + e);
       try {
         socket.close();
       } catch (IOException e1) {
         // OK, close failed - not much to do about it...
       }
     }
   }
   sessionIsRunning = false;
   // We are done closing down actions, remove us from list of active
   // sessions
   sessions.remove(this);
   logger.info("Disconnected from " + remoteAddress);
 }
示例#18
0
  private void startClient(final Socket s) {
    final GitDaemonClient dc = new GitDaemonClient(this);

    final SocketAddress peer = s.getRemoteSocketAddress();
    if (peer instanceof InetSocketAddress)
      dc.setRemoteAddress(((InetSocketAddress) peer).getAddress());

    new Thread(processors, "Git-Daemon-Client " + peer.toString()) {
      public void run() {
        try {
          dc.execute(s);
        } catch (ServiceNotEnabledException e) {
          // Ignored. Client cannot use this repository.
        } catch (ServiceNotAuthorizedException e) {
          // Ignored. Client cannot use this repository.
        } catch (IOException e) {
          // Ignore unexpected IO exceptions from clients
        } finally {
          try {
            s.getInputStream().close();
          } catch (IOException e) {
            // Ignore close exceptions
          }
          try {
            s.getOutputStream().close();
          } catch (IOException e) {
            // Ignore close exceptions
          }
        }
      }
    }.start();
  }
示例#19
0
 @Override
 public void run() {
   try {
     ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
     // Get worker name
     // Modified the server to expect a username when the client first
     // connects. It passes the user who joined to a (unfinished)
     // onJoin callback
     String username = (String) in.readObject();
     onJoin(username);
     while (true) {
       Message msg = (Message) in.readObject();
       onNewMessage(socket, msg);
     }
   } catch (IOException e) {
     Log.e(
         TAG, String.format("Connection lost from client: %s", socket.getRemoteSocketAddress()));
     clients.remove(socket);
   } catch (ClassNotFoundException e) {
     Log.e(TAG, "Received invalid task from client.");
   } finally {
     try {
       socket.close();
     } catch (IOException e) {
       Log.e(TAG, "Unable to close connection");
     }
   }
 }
 /** @see com.thinkparity.network.NetworkConnection#connect() */
 @Override
 public void connect() throws NetworkException {
   logger.logTraceId();
   logger.logInfo("{0} - Connect.", getId());
   Exception lastX = null;
   connected = false;
   for (final NetworkProxy proxy : proxies) {
     this.proxy = proxy;
     try {
       connectViaProxy();
       setSocketOptions();
       setSocketStreams();
       logger.logInfo("{0} - Connected.", getId());
       logger.logDebug(
           "{0} - Local:  {1}:{2}",
           getId(), socket.getLocalAddress().getHostAddress(), socket.getLocalPort());
       final InetSocketAddress remoteSocketAddress =
           (InetSocketAddress) socket.getRemoteSocketAddress();
       logger.logDebug(
           "{0} - Remote:  {1}:{2}",
           getId(),
           remoteSocketAddress.getAddress().getHostAddress(),
           remoteSocketAddress.getPort());
       connected = true;
       break;
     } catch (final SocketException sx) {
       lastX = sx;
     } catch (final IOException iox) {
       lastX = iox;
     }
   }
   if (false == connected) {
     throw new NetworkException(lastX);
   }
 }
示例#21
0
  private void serveConnection(final Socket raw) {
    String name = "MockWebServer-" + raw.getRemoteSocketAddress();
    executor.submit(
        namedCallable(
            name,
            new Callable<Void>() {
              int sequenceNumber = 0;

              public Void call() throws Exception {
                Socket socket;
                if (sslSocketFactory != null) {
                  if (tunnelProxy) {
                    if (!processOneRequest(raw.getInputStream(), raw.getOutputStream())) {
                      throw new IllegalStateException("Tunnel without any CONNECT!");
                    }
                  }
                  socket =
                      sslSocketFactory.createSocket(
                          raw, raw.getInetAddress().getHostAddress(), raw.getPort(), true);
                  ((SSLSocket) socket).setUseClientMode(false);
                } else {
                  socket = raw;
                }

                InputStream in = new BufferedInputStream(socket.getInputStream());
                OutputStream out = new BufferedOutputStream(socket.getOutputStream());

                if (!processOneRequest(in, out)) {
                  throw new IllegalStateException("Connection without any request!");
                }
                while (processOneRequest(in, out)) {}

                in.close();
                out.close();
                raw.close();
                openClientSockets.remove(raw);
                return null;
              }

              /**
               * Reads a request and writes its response. Returns true if a request was processed.
               */
              private boolean processOneRequest(InputStream in, OutputStream out)
                  throws IOException, InterruptedException {
                RecordedRequest request = readRequest(in, sequenceNumber);
                if (request == null) {
                  return false;
                }
                MockResponse response = dispatch(request);
                writeResponse(out, response);
                if (response.getDisconnectAtEnd()) {
                  in.close();
                  out.close();
                }
                sequenceNumber++;
                return true;
              }
            }));
  }
示例#22
0
 private void printSpecs() {
   System.out.println("\n\n****************Client Details***********************");
   System.out.println("Request : " + requestLine);
   System.out.println("Remote Client Hostname : " + socket.getRemoteSocketAddress().toString());
   System.out.println("Protocol : TCP/IP");
   System.out.println("Socket Type : Connection Oriented");
   System.out.println("*****************************************************");
 }
示例#23
0
    protected void preRouteMuleMessage(final DefaultMuleMessage message) throws Exception {
      super.preRouteMuleMessage(message);

      final SocketAddress clientAddress = socket.getRemoteSocketAddress();
      if (clientAddress != null) {
        message.setProperty(MuleProperties.MULE_REMOTE_CLIENT_ADDRESS, clientAddress.toString());
      }
    }
示例#24
0
 public FileClient(Socket s, FileClientListener listener) throws IOException {
   this.socket = s;
   this.listener = listener;
   in = new ObjectInputStream(socket.getInputStream());
   this.peerAddress =
       ((InetSocketAddress) s.getRemoteSocketAddress()).getAddress().getHostAddress();
   out = new ObjectOutputStream(s.getOutputStream());
   running = false;
 }
示例#25
0
  public SocketClient(
      WaageConfiguration waageConfiguration, Integer waagenindex, AbasRueckmeldung abasrueck)
      throws UnknownHostException {
    super("SocketClient ");
    Waage waage = null;
    try {
      this.waageConfiguration = waageConfiguration;
      this.abasrueckmeldung = abasrueck;

      waage = this.waageConfiguration.getWaage(waagenindex);

      this.leuchtZeit = waage.getLeuchtdauer();
      this.textZeit = waage.getTextdauer();
      this.waageName = waage.getName();
      this.waageIP = waage.getIpadress();
      this.waagePort = waage.getPort();
      super.setName("TestSocket " + waageName + " " + super.getId());
      while (this.socket == null) {
        if (checkHost(waage.getIpadress())) {
          try {
            this.socket = new Socket(waage.getIpadress(), waage.getPort());
            this.socket.setKeepAlive(true);
            this.socketadress = socket.getRemoteSocketAddress();
            log.info(
                this.waageName
                    + " Die Waage"
                    + waage.getName()
                    + " mit der IP-Adresse "
                    + waage.getIpadress()
                    + " wird nun überwacht");
          } catch (Exception e) {
            log.error(
                this.waageName
                    + " Die Socketverbindung zu Waage "
                    + waageName
                    + " mit IP "
                    + waageIP
                    + " konte nicht hergestellt werden",
                e);
          }

        } else {
          log.error(
              this.waageName
                  + " Die Waage"
                  + waage.getName()
                  + " mit der IP-Adresse "
                  + waage.getIpadress()
                  + " ist nicht erreichbar");
        }
      }
      setDesonnected(false);
      start();
    } catch (BadAttributeValueExpException e) {
      log.error(e);
    }
  }
示例#26
0
  protected void connect(Socket socket) throws IOException {
    if (LOGGER.isInfoEnabled()) {
      SocketAddress address = socket.getRemoteSocketAddress();
      LOGGER.info().append("Connected to ").append(address).commit();
    }

    setSessionStatus(SessionStatus.SocketConnected);
    connect(getInputChannel(socket), getOutputChannel(socket));
  }
示例#27
0
 /**
  * Returns the IP address and port of the remote end of the TCP connection, or null if this
  * connection is not connected.
  */
 public InetSocketAddress getRemoteAddressTCP() {
   SocketChannel socketChannel = tcp.socketChannel;
   if (socketChannel != null) {
     Socket socket = tcp.socketChannel.socket();
     if (socket != null) {
       return (InetSocketAddress) socket.getRemoteSocketAddress();
     }
   }
   return null;
 }
  @Override
  public String toString() {

    SocketAddress remoteSocketAddress = socket.getRemoteSocketAddress();
    String state = "Disconnected";
    if (remoteSocketAddress != null) {
      state = ((InetSocketAddress) remoteSocketAddress).getAddress().getHostAddress();
    }
    return "AuthenticationThread [" + state + "]";
  }
  /**
   * Creates a new BLOB connection for a client request
   *
   * @param clientSocket The socket to read/write data.
   * @param blobServer The BLOB server.
   */
  BlobServerConnection(Socket clientSocket, BlobServer blobServer) {
    super("BLOB connection for " + clientSocket.getRemoteSocketAddress().toString());
    setDaemon(true);

    if (blobServer == null) {
      throw new NullPointerException();
    }

    this.clientSocket = clientSocket;
    this.blobServer = blobServer;
  }
示例#30
0
    public void run() {
      // Setup context so all counters increments in this thread will get
      // tagged
      TaggingContext.setTags(tags);

      try {
        doWork();
      } catch (IOException e) {
        SocketAddress a = s.getRemoteSocketAddress();
        LOGGER.error("failure handling connection from " + a, e);
      }
    }