예제 #1
0
 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);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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), "");
 }
예제 #4
0
 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);
 }
예제 #5
0
 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));
 }