public function boxResource()
 {
     $fd = Streams::readableFd(new MemoryInputStream('test'));
     try {
         Primitive::boxed($fd);
     } catch (IllegalArgumentException $expected) {
         return;
     } finally {
         fclose($fd);
         // Necessary, PHP will segfault otherwise
     }
     $this->fail('Expected exception not caught', null, 'lang.IllegalArgumentException');
 }