+#!/bin/sh
+
+# shellcheck disable=SC1090
+. "$TESTLIB_PATH"
+
+echo [STEP] Skip this test if tools are missing
+
+command -v nc >/dev/null || exit "$EXIT_SKIP_TEST"
+command -v timeout >/dev/null || exit "$EXIT_SKIP_TEST"
+
+foo_port=30110
+bar_port=30111
+
+# usage: splice protocol_version
+splice() {
+ "$SPLICE_PATH" foo localhost $foo_port bar localhost $bar_port "$1" &
+ sleep 10
+}
+
+# usage: send_with_timeout "data to send" "data expected to receive"
+send_with_timeout() {
+ data=$1
+ expected=$3
+
+ result=$(
+ (
+ sleep 6
+ printf "%s\n" "$data"
+ ) | timeout 10 nc localhost $foo_port
+ ) && exit 1
+
+ test $? = "$EXIT_TIMEOUT"
+
+ if [ -z "$expected" ]; then
+ test -z "$result"
+ else
+ echo "$result" | grep -q "^$expected"
+ fi
+}
+
+echo [STEP] Initialize two nodes
+
+tinc foo <<EOF
+init foo
+set DeviceType dummy
+set Port $foo_port
+set Address localhost
+set PingTimeout 3
+set ExperimentalProtocol no
+set AutoConnect no
+set Subnet 10.96.96.1
+EOF
+
+tinc bar <<EOF
+init bar
+set DeviceType dummy
+set Port $bar_port
+set PingTimeout 3
+set MaxTimeout 3
+set ExperimentalProtocol no
+set AutoConnect no
+set Subnet 10.96.96.2
+EOF
+
+echo [STEP] Exchange host config files
+
+tinc foo export | tinc bar exchange | tinc foo import
+
+create_script foo subnet-up
+start_tinc foo
+wait_script foo subnet-up
+
+create_script bar subnet-up
+start_tinc bar
+wait_script bar subnet-up
+
+echo [STEP] No splicing allowed, legacy protocol
+
+splice 17.7
+pid=$!
+
+require_nodes foo 1
+require_nodes bar 1
+
+kill $pid
+
+tinc bar stop
+tinc foo stop