HTTP_Adapter: split into f_http_tx_request() / f_http_rx_response()

There are some use cases in which we don't want a blocking wait for the
full HTTP request to complete.  Let's split it up in two parts, and
make the existing f_http_transact() a wrapper around them.

Also, enable the generation of the Connect_result primitive to detect
connection failures.

Change-Id: I5c7575c0b58c3606d25d8f8cfccd47cfb7a8c400
diff --git a/library/HTTP_Adapter.ttcn b/library/HTTP_Adapter.ttcn
index 03de1f3..a957fdd 100644
--- a/library/HTTP_Adapter.ttcn
+++ b/library/HTTP_Adapter.ttcn
@@ -71,17 +71,17 @@
 
 template HTTPMessage tr_HTTP_Resp2xx := tr_HTTP_Resp((200..299));
 
-/* run a HTTP request and return the response */
-function f_http_transact(charstring url, charstring method := "GET",
-			 charstring body := "", template HTTPMessage exp := tr_HTTP_Resp2xx,
-			 float tout := 2.0)
+function f_http_tx_request(charstring url, charstring method := "GET", charstring body := "")
+runs on http_CT {
+	HTTP.send(ts_HTTP_Connect(g_http_host, g_http_port));
+	HTTP.receive(Connect_result:?);
+	HTTP.send(ts_HTTP_Req(url, method, body));
+}
+
+function f_http_rx_response(template HTTPMessage exp := tr_HTTP_Resp2xx, float tout := 2.0)
 runs on http_CT return HTTPMessage {
 	var HTTPMessage resp;
 	timer T := tout;
-
-	HTTP.send(ts_HTTP_Connect(g_http_host, g_http_port));
-	//HTTP.receive(Connect_result:?);
-	HTTP.send(ts_HTTP_Req(url, method, body));
 	T.start;
 	alt {
 	[] HTTP.receive(exp) -> value resp {
@@ -99,4 +99,13 @@
 	return resp;
 }
 
+/* run a HTTP request and return the response */
+function f_http_transact(charstring url, charstring method := "GET",
+			 charstring body := "", template HTTPMessage exp := tr_HTTP_Resp2xx,
+			 float tout := 2.0)
+runs on http_CT return HTTPMessage {
+	f_http_tx_request(url, method, body);
+	return f_http_rx_response(exp, tout);
+}
+
 }
diff --git a/remsim/REMSIM_Tests.default b/remsim/REMSIM_Tests.default
index 7a41555..3059a8d 100644
--- a/remsim/REMSIM_Tests.default
+++ b/remsim/REMSIM_Tests.default
@@ -1,3 +1,3 @@
 [TESTPORT_PARAMETERS]
 system.HTTP.http_debugging := "yes"
-system.HTTP.use_notification_ASPs := "no"
+system.HTTP.use_notification_ASPs := "yes"