summaryrefslogtreecommitdiff
path: root/dist/IO/t/cachepropagate-tcp.t
diff options
context:
space:
mode:
Diffstat (limited to 'dist/IO/t/cachepropagate-tcp.t')
-rw-r--r--dist/IO/t/cachepropagate-tcp.t43
1 files changed, 43 insertions, 0 deletions
diff --git a/dist/IO/t/cachepropagate-tcp.t b/dist/IO/t/cachepropagate-tcp.t
new file mode 100644
index 0000000000..40f36be274
--- /dev/null
+++ b/dist/IO/t/cachepropagate-tcp.t
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use IO::Socket;
+use IO::Socket::INET;
+use Test;
+
+plan tests => 8;
+
+my $listener = IO::Socket::INET->new(Listen => 1,
+ LocalAddr => '127.0.0.1',
+ Proto => 'tcp');
+ok(defined($listener));
+
+my $port = $listener->sockport();
+
+my $p = $listener->protocol();
+ok(defined($p));
+my $d = $listener->sockdomain();
+ok(defined($d));
+my $s = $listener->socktype();
+ok(defined($s));
+
+my $cpid = fork();
+ok(defined($cpid));
+if (0 == $cpid) {
+ # the child:
+ sleep(1);
+ my $connector = IO::Socket::INET->new(PeerAddr => '127.0.0.1',
+ PeerPort => $port,
+ Proto => 'tcp');
+ exit(0);
+};
+
+my $new = $listener->accept();
+
+ok($new->protocol(), $p);
+ok($new->sockdomain(), $d);
+ok($new->socktype(), $s);
+
+wait();