diff --git a/test/box/protocol.c b/test/box/protocol.c
index 4ad75a341bcba42e557107eb440e8e88b4ac6076..fa2d6d5ddcf5ac926b6c701bef238feae7dac34c 100644
--- a/test/box/protocol.c
+++ b/test/box/protocol.c
@@ -1,33 +1,46 @@
 #include <connector/c/client.h>
 #include <stdio.h>
 
-int main() {
-  struct tnt_connection *conn = tnt_connect("localhost", 33013);
-  if (conn == NULL)
-	  return 1;
+/** Server connection. Reused between tests. */
+struct tnt_connection *conn;
 
-  {
-    const char message[]= {
-	    0xd, 0x0, 0x0, 0x0,    0x11, 0x0, 0x0, 0x0,    0x0, 0x0, 0x0, 0x0,
-	    0x0, 0x0, 0x0, 0x0,    0x0, 0x0, 0x0, 0x0,     0x1, 0x0, 0x0, 0x0,
-	    0x4,    0x1, 0x0, 0x0, 0x0 };
-    int res = tnt_execute_raw(conn, message, sizeof message);
-    printf("return_code: %d\n", res); // =0
-  }
-  {
-    /*
-     * A test case for Bug#702397
-     * https://bugs.launchpad.net/tarantool/+bug/702397
-     * "If SELECT request specifies tuple count 0, no error"
-     */
-    const char message[]= {
-	    0x11, 0x0, 0x0, 0x0,    0x14, 0x0, 0x0, 0x0,    0x0, 0x0, 0x0, 0x0,
-	    0x0, 0x0, 0x0, 0x0,     0x0, 0x0, 0x0, 0x0,     0x0, 0x0, 0x0, 0x0,
-	    0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 };
-    int res = tnt_execute_raw(conn, message, sizeof message);
-    printf("return_code: %d\n", res); // =2
-  }
+/** Test the ping command. */
+void test_ping()
+{
+	const char message[]= {
+		0xd, 0x0, 0x0, 0x0,    0x11, 0x0, 0x0, 0x0,
+		0x0, 0x0, 0x0, 0x0,    0x0, 0x0, 0x0, 0x0,
+		0x0, 0x0, 0x0, 0x0,    0x1, 0x0, 0x0, 0x0,
+		0x4, 0x1, 0x0, 0x0, 0x0 };
+	int res = tnt_execute_raw(conn, message, sizeof message);
+	printf("return_code: %d\n", res); /* =0 */
+}
+
+
+void test_bug702397()
+{
+	/*
+	 * A test case for Bug#702397
+	 * https://bugs.launchpad.net/tarantool/+bug/702397
+	 * "If SELECT request specifies tuple count 0, no error"
+         */
+	const char message[]= {
+		0x11, 0x0, 0x0, 0x0,    0x14, 0x0, 0x0, 0x0,    0x0, 0x0, 0x0, 0x0,
+		0x0, 0x0, 0x0, 0x0,     0x0, 0x0, 0x0, 0x0,     0x0, 0x0, 0x0, 0x0,
+		0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 };
+	int res = tnt_execute_raw(conn, message, sizeof message);
+	printf("return_code: %d\n", res); // =2
+}
+
+int main()
+{
+	conn = tnt_connect("localhost", 33013);
+	if (conn == NULL)
+		return 1;
+
+	test_ping();
+	test_bug702397();
 
-  tnt_disconnect(conn);
+	tnt_disconnect(conn);
   return 0;
 }