3 do './testlib.pl' || do './t/testlib.pl' || die "no testlib";
8 my ($server,$saddr) = create_listen_socket();
11 # first try bad non-SSL client
12 my $srv = fork_sub( 'server' );
13 fd_grep_ok( 'Waiting', $srv );
14 my $cl = fork_sub( 'client_no_ssl' );
15 fd_grep_ok( 'Connect from',$srv );
16 fd_grep_ok( 'Connected', $cl );
17 fd_grep_ok( 'SSL Handshake FAILED', $srv );
21 $srv = fork_sub( 'server' );
22 fd_grep_ok( 'Waiting', $srv );
23 $cl = fork_sub( 'client_ssl' );
24 fd_grep_ok( 'Connect from',$srv );
25 fd_grep_ok( 'Connected', $cl );
26 fd_grep_ok( 'SSL Handshake OK', $srv );
27 fd_grep_ok( 'Hi!', $cl );
33 my $client = $server->accept || die "accept failed: $!";
34 print "Connect from ".$client->peerhost.':'.$client->peerport."\n";
35 if ( IO::Socket::SSL->start_SSL( $client, SSL_server => 1, Timeout => 5 )) {
36 print "SSL Handshake OK\n";
37 print $client "Hi!\n";
39 print "SSL Handshake FAILED - $!\n"
44 my $c = IO::Socket::INET->new( $saddr ) || die "connect failed: $!";
46 while ( sysread( $c,my $buf,8000 )) {}
50 my $c = IO::Socket::SSL->new( $saddr ) || die "connect failed: $!";
52 while ( sysread( $c,my $buf,8000 )) { print $buf }