public function testSocketClosure() { $socket = new SimpleSocket('www.lastcraft.com', 80, 15, 8); $this->assertTrue($socket->isOpen()); $this->assertTrue($socket->write("GET /test/network_confirm.php HTTP/1.0\r\n")); $socket->write("Host: www.lastcraft.com\r\n"); $socket->write("Connection: close\r\n\r\n"); $this->assertEqual($socket->read(), "HTTP/1.1"); $socket->close(); $this->assertIdentical($socket->read(), false); }
public function testSocketClosure() { $socket = new SimpleSocket($this->host, $this->port, 15, 8); $this->assertTrue($socket->isOpen()); $this->assertTrue($socket->write("GET /network_confirm.php HTTP/1.0\r\n")); $socket->write("Host: {$this->host}\r\n"); $socket->write("Connection: close\r\n\r\n"); $this->assertEqual($socket->read(), 'HTTP/1.0'); $socket->close(); $this->assertIdentical($socket->read(), false); }
function testSocket() { $socket = new SimpleSocket("www.lastcraft.com", 80); $this->assertFalse($socket->isError(), "Error [" . $socket->getError() . "]"); $this->assertTrue($socket->isOpen()); $this->assertTrue($socket->write("GET www.lastcraft.com/test/network_confirm.php HTTP/1.0\r\n")); $socket->write("Host: localhost\r\n"); $socket->write("Connection: close\r\n\r\n"); $this->assertEqual($socket->read(8), "HTTP/1.1"); $socket->close(); $this->assertEqual($socket->read(8), ""); }
function testSocketClosure() { $site = $this->getServerInfo(); $socket = new SimpleSocket($site['host'], $site['port'], 15, 8); $this->assertTrue($socket->isOpen()); $this->assertTrue($socket->write("GET {$site['path']}network_confirm.php HTTP/1.0\r\n")); $socket->write("Host: {$site['host']}\r\n"); $socket->write("Connection: close\r\n\r\n"); $this->assertEqual($socket->read(), "HTTP/1.1"); $socket->close(); $this->assertIdentical($socket->read(), false); }
function skip() { $socket = new SimpleSocket($this->host, $this->port, 5, 8); parent::skipIf(!$socket->isOpen(), sprintf('The LiveHttpTestCase requires that a webserver runs at %s:%s', $this->host, $this->port)); }