public void run() {
		try {
			byte[] buffer = new byte[BUFFER_SIZE];

			while (true) {
				final int bytesRead = m_in.read(buffer, 0, BUFFER_SIZE);

				if (bytesRead == -1) {
					break;
				}

				final byte[] newBytes =
					m_filter.handle(m_connectionDetails, buffer, bytesRead);

				m_outputWriter.flush();

				if (newBytes != null) {
					m_out.write(newBytes);
				} else {
					m_out.write(buffer, 0, bytesRead);
				}
			}
		} catch (SocketException e) {
			// Be silent about SocketExceptions.
		} catch (Exception e) {
			e.printStackTrace(System.err);
		}

		try {
			m_filter.connectionClosed(m_connectionDetails);
		} catch (Exception e) {
			e.printStackTrace(System.err);
		}

		m_outputWriter.flush();

		// We're exiting, usually because the in stream has been
		// closed. Whatever, close our streams. This will cause the
		// paired thread to exit to.
		try {
			m_out.close();
		} catch (Exception e) {
		}

		try {
			m_in.close();
		} catch (Exception e) {
		}
	}