public MpimParseInput(Proxy proxy) throws ConnectionClosedException 
	{
		//assert(parse != null && proxy != null);
		assert(proxy != null);
		String inicial ="<stream>";
		String end = "</stream>";
		String tmp;
		int i;
		
		body = null;
		accounts = proxy;
		try{
			byte data[] = new byte[accounts.getConnection().socket().getSendBufferSize()];

			if(accounts.getConnection().socket().getInputStream().read(data) == -1) {
				// Channel is closed, close the channel and remove the key from the selector
				accounts.close();
				throw new ConnectionClosedException("Connection is closed"); 
			} else {
				parse = inicial;
				tmp = new String(data).trim();
				i = tmp.indexOf("<body>");
				if(i == -1 )
					parse += tmp + end;
				else {
					parse += tmp.substring(0, i + "<body>".length()) + " ";
					body = tmp.substring(i + "<body>".length(), tmp.lastIndexOf("</body>"));
					parse += tmp.substring(tmp.lastIndexOf("</body>")) + end;
					
				}
			}

			if(parse.equals("\0") || parse.length()==0)
				parse = null;

		} catch(NullPointerException e) {
			System.err.println("(EE) Unrecoverable error: the socket is null");
		} catch (SocketException e) {
			try {
				accounts.close();
			} catch(NullPointerException e1) {
			}
				throw new ConnectionClosedException("Connection is closed");
		} catch (IOException e) {
		}
	}