private void sendRequestAnnounce() throws IllegalStateException, SocketException, IOException {

		String body = mParameters.session.getSessionDescription();
		String request = "ANNOUNCE rtsp://"+mParameters.host+":"+mParameters.port+mParameters.path+" RTSP/1.0\r\n" +
				"CSeq: " + (++mCSeq) + "\r\n" +
				"Content-Length: " + body.length() + "\r\n" +
				"Content-Type: application/sdp\r\n\r\n" +
				body;
		Log.i(TAG,request.substring(0, request.indexOf("\r\n")));

		mOutputStream.write(request.getBytes("UTF-8"));
		mOutputStream.flush();
		Response response = Response.parseResponse(mBufferedReader);

		if (response.headers.containsKey("server")) {
			Log.v(TAG,"RTSP server name:" + response.headers.get("server"));
		} else {
			Log.v(TAG,"RTSP server name unknown");
		}

		if (response.headers.containsKey("session")) {
			try {
				Matcher m = Response.rexegSession.matcher(response.headers.get("session"));
				m.find();
				mSessionID = m.group(1);
			} catch (Exception e) {
				throw new IOException("Invalid response from server. Session id: "+mSessionID);
			}
		}

		if (response.status == 401) {
			String nonce, realm;
			Matcher m;

			if (mParameters.username == null || mParameters.password == null) throw new IllegalStateException("Authentication is enabled and setCredentials(String,String) was not called !");

			try {
				m = Response.rexegAuthenticate.matcher(response.headers.get("www-authenticate")); m.find();
				nonce = m.group(2);
				realm = m.group(1);
			} catch (Exception e) {
				throw new IOException("Invalid response from server");
			}

			String uri = "rtsp://"+mParameters.host+":"+mParameters.port+mParameters.path;
			String hash1 = computeMd5Hash(mParameters.username+":"+m.group(1)+":"+mParameters.password);
			String hash2 = computeMd5Hash("ANNOUNCE"+":"+uri);
			String hash3 = computeMd5Hash(hash1+":"+m.group(2)+":"+hash2);

			mAuthorization = "Digest username=\""+mParameters.username+"\",realm=\""+realm+"\",nonce=\""+nonce+"\",uri=\""+uri+"\",response=\""+hash3+"\"";

			request = "ANNOUNCE rtsp://"+mParameters.host+":"+mParameters.port+mParameters.path+" RTSP/1.0\r\n" +
					"CSeq: " + (++mCSeq) + "\r\n" +
					"Content-Length: " + body.length() + "\r\n" +
					"Authorization: " + mAuthorization + "\r\n" +
					"Session: " + mSessionID + "\r\n" +
					"Content-Type: application/sdp\r\n\r\n" +
					body;

			Log.i(TAG,request.substring(0, request.indexOf("\r\n")));

			mOutputStream.write(request.getBytes("UTF-8"));
			mOutputStream.flush();
			response = Response.parseResponse(mBufferedReader);

			if (response.status == 401) throw new RuntimeException("Bad credentials !");

		} else if (response.status == 403) {
			throw new RuntimeException("Access forbidden !");
		}

	}
Forges and sends the ANNOUNCE request
src/net/majorkernelpanic/streaming/rtsp/RtspClient.java