Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,37 @@ public function gettingEncryptedStuffFromGoogleShouldWork()
$this->assertRegExp('#^HTTP/1\.0#', $response);
}

/** @test */
public function gettingEncryptedStuffFromHostWithSniShouldWork()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on HHVM');
}

$loop = new StreamSelectLoop();

$factory = new Factory();
$dns = $factory->create('8.8.8.8', $loop);

$connected = false;
$response = null;

$secureConnector = new SecureConnector(
new Connector($loop, $dns),
$loop
);

$conn = Block\await($secureConnector->create('reactphp.sni.velox.ch', 443), $loop);

$conn->write("GET / HTTP/1.0\r\nHost: reactphp.sni.velox.ch\r\n\r\n");

$response = Block\await(BufferedSink::createPromise($conn), $loop);

$this->assertRegExp('#^HTTP/1\.[01] 2\d\d#', $response);
$this->assertRegExp('#<strong>reactphp\.sni\.velox\.ch</strong>#', $response);
$this->assertRegExp('#<strong>CN=\*\.sni\.velox\.ch</strong>#', $response);
}

/** @test */
public function testSelfSignedRejectsIfVerificationIsEnabled()
{
Expand Down