Debug.println("read " + nread);
	public void run() {		MyFilterInputStream inputStream = null;		inputStream = new MyFilterInputStream(this.rawInputStream);		// I cannot use buffered reader here because we may need to switch		// encodings to read the message body.		try {			while (true) {				StringBuffer inputBuffer = new StringBuffer();				Debug.println("Starting parse!");				String line1;				String line2 = null;				// ignore blank lines.				while (true) {					try {						line1 = readLine(inputStream);						if (line1.equals("\n")) {							Debug.println("Discarding " + line1);							continue;						} else							break;					} catch (IOException ex) {						Debug.printStackTrace(ex);						return;					}				}				Debug.println("line1  = " + line1);				inputBuffer.append(line1);				while (true) {					try {						line2 = readLine(inputStream);						inputBuffer.append(line2);						if (line2.trim().equals(""))							break;					} catch (IOException ex) {						Debug.printStackTrace(ex);						return;					}				}				inputBuffer.append(line2);				StringMsgParser smp = new StringMsgParser(sipMessageListener);				smp.readBody = false;				SIPMessage sipMessage = null;				try {					sipMessage = smp.parseSIPMessage(inputBuffer.toString());					if (sipMessage == null)						continue;				} catch (ParseException ex) {					// Just ignore the parse exception.					continue;				}				Debug.println("Completed parsing message");				ContentLength cl =					(ContentLength) sipMessage.getContentLength();				int contentLength = 0;				if (cl != null) {					contentLength = cl.getContentLength();				} else {					contentLength = 0;				}				if (contentLength == 0) {					Debug.println("content length " + contentLength);					sipMessage.removeContent();				} else { // deal with the message body.					contentLength = cl.getContentLength();					Debug.println("content length " + contentLength);										byte[] message_body = new byte[contentLength];					int nread = 0;					while (nread < contentLength) {						try {							int readlength =								inputStream.read(									message_body,									nread,									contentLength - nread);							if (readlength >= 0) {								nread += readlength;								Debug.println("read " + nread);							} else {								break;							}						} catch (IOException ex) {							ex.printStackTrace();							break;						}					}					sipMessage.setMessageContent(message_body);				}				if (sipMessageListener != null) {					sipMessageListener.processMessage(sipMessage);				}			}		} finally {			try {				inputStream.close();			} catch (IOException ioe) {			}		}	}