You used the inline command to send command to Redis, which does not work with binary data, or data which has 0 length or contains whitespace.
Instead, you should use the more complicated form: *3
$3
set
$0
$3
val
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
*3
$3
set
$0
$3
val
+OK
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…