+ nodes[3].custom_message_handler.expect_message(TestCustomMessage::Pong);
+ pass_along_path(&nodes);
+}
+
+#[test]
+fn async_response_over_one_blinded_hop() {
+ // Simulate an asynchronous interaction between two nodes, Alice and Bob.
+
+ // 1. Set up the network with two nodes: Alice and Bob.
+ let nodes = create_nodes(2);
+ let alice = &nodes[0];
+ let bob = &nodes[1];
+
+ // 2. Define the message sent from Bob to Alice.
+ let message = TestCustomMessage::Ping;
+ let path_id = Some([2; 32]);
+
+ // 3. Simulate the creation of a Blinded Reply path provided by Bob.
+ let secp_ctx = Secp256k1::new();
+ let reply_path = BlindedPath::new_for_message(&[], nodes[1].node_id, &*nodes[1].entropy_source, &secp_ctx).unwrap();
+
+ // 4. Create a responder using the reply path for Alice.
+ let responder = Some(Responder::new(reply_path, path_id));
+
+ // 5. Expect Alice to receive the message and create a response instruction for it.
+ alice.custom_message_handler.expect_message(message.clone());
+ let response_instruction = nodes[0].custom_message_handler.handle_custom_message(message, responder);
+
+ // 6. Simulate Alice asynchronously responding back to Bob with a response.
+ assert_eq!(
+ nodes[0].messenger.handle_onion_message_response(response_instruction),
+ Ok(Some(SendSuccess::Buffered)),
+ );
+
+ bob.custom_message_handler.expect_message(TestCustomMessage::Pong);
+