about summary refs log tree commit homepage
path: root/t/common.perl
diff options
context:
space:
mode:
Diffstat (limited to 't/common.perl')
-rw-r--r--t/common.perl18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/common.perl b/t/common.perl
index 5a898e32..3f05b68a 100644
--- a/t/common.perl
+++ b/t/common.perl
@@ -17,6 +17,24 @@ sub stream_to_string {
         $str;
 }
 
+sub tcp_server () {
+        IO::Socket::INET->new(
+                LocalAddr => '127.0.0.1',
+                ReuseAddr => 1,
+                Proto => 'tcp',
+                Type => Socket::SOCK_STREAM(),
+                Listen => 1024,
+        )
+}
+
+sub unix_server ($) {
+        IO::Socket::UNIX->new(
+                Listen => 1024,
+                Type => Socket::SOCK_STREAM(),
+                Local => $_[0],
+        )
+}
+
 sub spawn_listener {
         my ($env, $cmd, $socks) = @_;
         my $pid = fork;