### ----------------------------------------------------
### -- IO::Socket::SSL
### -- Licenses: MIT
### -- Authors: Filip Sergot
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use IO::Socket::SSL;

plan 2;

my IO::Socket $ssl = IO::Socket::SSL.new(:host<github.com>, :port(443));
isa-ok $ssl, IO::Socket::SSL, 'new 1/1';
$ssl.close;

unless %*ENV<NETWORK_TESTING> {
    diag "NETWORK_TESTING was not set";
    skip-rest("NETWORK_TESTING was not set");
    exit;
}

subtest {
    lives-ok { $ssl = IO::Socket::SSL.new(:host<google.com>, :port(443)) };
    is $ssl.print("GET / HTTP/1.1\r\nHost:www.google.com\r\nConnection:close\r\n\r\n"), 57;
    ok $ssl.get ~~ /\s3\d\d\s/|/\s2\d\d\s/;
    $ssl.close;
}, 'google: ssl';

# vim: expandtab shiftwidth=4


