protected function userpass(\Erebot\URIInterface $proxyURI)
    {
        $username = $proxyURI->asParsedURL(PHP_URL_USER);
        $password = $proxyURI->asParsedURL(PHP_URL_PASS);

        if ($username === null || $password === null) {
            throw new \Erebot\InvalidValueException(
                'No username or password supplied'
            );
        }

        $ulen = strlen($username);
        $plen = strlen($password);
        if ($ulen > 255) {
            throw new \Erebot\InvalidValueException(
                'Username too long (max. 255)'
            );
        }

        if ($plen > 255) {
            throw new \Erebot\InvalidValueException(
                'Password too long (max. 255)'
            );
        }

        $this->write(
            "\x01".pack(
                "Ca*Ca*",
                $ulen,
                $username,
                $plen,
                $password
            )
        );
        $line = $this->read(2);

        if ($line[0] != "\x01") {
            throw new \Erebot\InvalidValueException(
                'Bad subnegociation version'
            );
        }

        if ($line[1] != "\x00") {
            throw new \Erebot\InvalidValueException('Bad username or password');
        }
    }