@Override public void run() { byte[] buf = new byte[100]; try { int len; while ((len = in.read(buf)) > 0) { String output = new String(buf, 0, len); Thread t = Thread.currentThread(); System.out.println( "thread " + t.getName() + " " + t.getId() + ", read " + len + " bytes: " + output); } } catch (IOException e) { logger.log(Level.SEVERE, "Failed to read", e); } finally { try { in.close(); } catch (IOException e) { logger.log(Level.SEVERE, "Failed to close", e); } } }