public static byte[] readRawHeaderLine(InputStream inputStream) throws IOException {
	        ByteArrayOutputStream buf = new ByteArrayOutputStream();
	        int ch;
	        int lastCh=0;
	        try{
		        while ((ch = inputStream.read()) >= 0) {
		            buf.write(ch);
		            if (ch == '\n' && lastCh=='\r') {
		                break;
		            }
		            lastCh=ch;
		        }
	        }catch(SocketTimeoutException STE){
	        	//It might be ok. We'll Try to recover from this.
	        }
	        if (buf.size() == 0) {
	            return null;
	        }
	        return buf.toByteArray();
	 }