fix some db docs
[factor/jcg.git] / basis / io / servers / connection / connection-tests.factor
blobae79290f0a014e3eeb2b0a7e604bd70305965f47
1 IN: io.servers.connection
2 USING: tools.test io.servers.connection io.sockets namespaces
3 io.servers.connection.private kernel accessors sequences
4 concurrency.promises io.encodings.ascii io threads calendar ;
6 [ t ] [ <threaded-server> listen-on empty? ] unit-test
8 [ f ] [
9     <threaded-server>
10         25 internet-server >>insecure
11     listen-on
12     empty?
13 ] unit-test
15 [ t ] [
16     T{ inet4 f "1.2.3.4" 1234 } T{ inet4 f "1.2.3.5" 1235 }
17     [ log-connection ] 2keep
18     [ remote-address get = ] [ local-address get = ] bi*
19     and
20 ] unit-test
22 [ ] [ <threaded-server> init-server drop ] unit-test
24 [ 10 ] [
25     <threaded-server>
26         10 >>max-connections
27     init-server semaphore>> count>> 
28 ] unit-test
30 [ ] [
31     <threaded-server>
32         5 >>max-connections
33         0 >>insecure
34         [ "Hello world." write stop-this-server ] >>handler
35     dup start-server* sockets>> first addr>> port>> "port" set
36 ] unit-test
38 [ "Hello world." ] [ "localhost" "port" get <inet> ascii <client> drop contents ] unit-test