connect('request_timeout', $this->clientBuilder()->setRequestTimeout(1)); try { $client->callTool('slow'); $this->fail('The slow tool should have outlived the request timeout.'); } catch (RequestException) { } // The server is still executing the abandoned call and cannot answer // anything until it returns, so the next request has to wait it out. sleep(2); // Without the pending request being cleared this answers 'late': the // response the client gave up on, handed to the request after it. $this->assertSame('quick', $client->callTool('fast')->content[0]->text ?? null); } }