1#!/usr/bin/env perl
2
3use strict;
4use warnings;
5use Test::More;
6use FindBin qw($Bin);
7use lib "$Bin/lib";
8use Carp qw(croak);
9use MemcachedTest;
10use IO::Socket qw(AF_INET SOCK_STREAM);
11use IO::Select;
12
13if (!supports_proxy()) {
14    plan skip_all => 'proxy not enabled';
15    exit 0;
16}
17
18# Set up the listeners _before_ starting the proxy.
19# the fourth listener is only occasionally used.
20my $t = Memcached::ProxyTest->new(servers => [12111]);
21
22my $p_srv = new_memcached('-o proxy_config=./t/proxyconfigmulti1.lua:./t/proxyconfigmulti2.lua -t 1');
23my $ps = $p_srv->sock;
24$ps->autoflush(1);
25
26$t->set_c($ps);
27$t->accept_backends();
28
29$t->c_send("mg foo\r\n");
30$t->be_recv_c(0);
31$t->be_send(0, "HD\r\n");
32$t->c_recv_be();
33
34done_testing();
35