eventmachine 0.12.6-java
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +13 -0
- data/Rakefile +262 -0
- data/docs/COPYING +60 -0
- data/docs/ChangeLog +211 -0
- data/docs/DEFERRABLES +138 -0
- data/docs/EPOLL +141 -0
- data/docs/GNU +281 -0
- data/docs/INSTALL +15 -0
- data/docs/KEYBOARD +38 -0
- data/docs/LEGAL +25 -0
- data/docs/LIGHTWEIGHT_CONCURRENCY +72 -0
- data/docs/PURE_RUBY +77 -0
- data/docs/README +74 -0
- data/docs/RELEASE_NOTES +96 -0
- data/docs/SMTP +9 -0
- data/docs/SPAWNED_PROCESSES +93 -0
- data/docs/TODO +10 -0
- data/eventmachine.gemspec +32 -0
- data/ext/binder.cpp +126 -0
- data/ext/binder.h +48 -0
- data/ext/cmain.cpp +586 -0
- data/ext/cplusplus.cpp +193 -0
- data/ext/ed.cpp +1522 -0
- data/ext/ed.h +380 -0
- data/ext/em.cpp +1937 -0
- data/ext/em.h +186 -0
- data/ext/emwin.cpp +300 -0
- data/ext/emwin.h +94 -0
- data/ext/epoll.cpp +26 -0
- data/ext/epoll.h +25 -0
- data/ext/eventmachine.h +98 -0
- data/ext/eventmachine_cpp.h +95 -0
- data/ext/extconf.rb +129 -0
- data/ext/fastfilereader/extconf.rb +77 -0
- data/ext/fastfilereader/mapper.cpp +214 -0
- data/ext/fastfilereader/mapper.h +59 -0
- data/ext/fastfilereader/rubymain.cpp +127 -0
- data/ext/files.cpp +94 -0
- data/ext/files.h +65 -0
- data/ext/kb.cpp +82 -0
- data/ext/page.cpp +107 -0
- data/ext/page.h +51 -0
- data/ext/pipe.cpp +351 -0
- data/ext/project.h +119 -0
- data/ext/rubymain.cpp +847 -0
- data/ext/sigs.cpp +89 -0
- data/ext/sigs.h +32 -0
- data/ext/ssl.cpp +423 -0
- data/ext/ssl.h +90 -0
- data/java/.classpath +8 -0
- data/java/.project +17 -0
- data/java/src/com/rubyeventmachine/Application.java +196 -0
- data/java/src/com/rubyeventmachine/Connection.java +74 -0
- data/java/src/com/rubyeventmachine/ConnectionFactory.java +37 -0
- data/java/src/com/rubyeventmachine/DefaultConnectionFactory.java +46 -0
- data/java/src/com/rubyeventmachine/EmReactor.java +408 -0
- data/java/src/com/rubyeventmachine/EmReactorException.java +40 -0
- data/java/src/com/rubyeventmachine/EventableChannel.java +57 -0
- data/java/src/com/rubyeventmachine/EventableDatagramChannel.java +171 -0
- data/java/src/com/rubyeventmachine/EventableSocketChannel.java +244 -0
- data/java/src/com/rubyeventmachine/PeriodicTimer.java +38 -0
- data/java/src/com/rubyeventmachine/Timer.java +54 -0
- data/java/src/com/rubyeventmachine/tests/ApplicationTest.java +108 -0
- data/java/src/com/rubyeventmachine/tests/ConnectTest.java +124 -0
- data/java/src/com/rubyeventmachine/tests/EMTest.java +80 -0
- data/java/src/com/rubyeventmachine/tests/TestDatagrams.java +53 -0
- data/java/src/com/rubyeventmachine/tests/TestServers.java +74 -0
- data/java/src/com/rubyeventmachine/tests/TestTimers.java +89 -0
- data/lib/em/deferrable.rb +208 -0
- data/lib/em/eventable.rb +39 -0
- data/lib/em/future.rb +62 -0
- data/lib/em/messages.rb +66 -0
- data/lib/em/processes.rb +113 -0
- data/lib/em/spawnable.rb +88 -0
- data/lib/em/streamer.rb +112 -0
- data/lib/eventmachine.rb +1926 -0
- data/lib/eventmachine_version.rb +31 -0
- data/lib/evma.rb +32 -0
- data/lib/evma/callback.rb +32 -0
- data/lib/evma/container.rb +75 -0
- data/lib/evma/factory.rb +77 -0
- data/lib/evma/protocol.rb +87 -0
- data/lib/evma/reactor.rb +48 -0
- data/lib/jeventmachine.rb +137 -0
- data/lib/pr_eventmachine.rb +1011 -0
- data/lib/protocols/buftok.rb +127 -0
- data/lib/protocols/header_and_content.rb +129 -0
- data/lib/protocols/httpcli2.rb +803 -0
- data/lib/protocols/httpclient.rb +270 -0
- data/lib/protocols/line_and_text.rb +126 -0
- data/lib/protocols/linetext2.rb +161 -0
- data/lib/protocols/memcache.rb +293 -0
- data/lib/protocols/postgres.rb +261 -0
- data/lib/protocols/saslauth.rb +179 -0
- data/lib/protocols/smtpclient.rb +308 -0
- data/lib/protocols/smtpserver.rb +556 -0
- data/lib/protocols/stomp.rb +153 -0
- data/lib/protocols/tcptest.rb +57 -0
- data/setup.rb +1585 -0
- data/tasks/cpp.rake +77 -0
- data/tasks/project.rake +78 -0
- data/tasks/tests.rake +193 -0
- data/tests/test_attach.rb +83 -0
- data/tests/test_basic.rb +231 -0
- data/tests/test_connection_count.rb +45 -0
- data/tests/test_defer.rb +47 -0
- data/tests/test_epoll.rb +163 -0
- data/tests/test_error_handler.rb +35 -0
- data/tests/test_errors.rb +82 -0
- data/tests/test_eventables.rb +77 -0
- data/tests/test_exc.rb +58 -0
- data/tests/test_futures.rb +214 -0
- data/tests/test_handler_check.rb +37 -0
- data/tests/test_hc.rb +218 -0
- data/tests/test_httpclient.rb +215 -0
- data/tests/test_httpclient2.rb +155 -0
- data/tests/test_kb.rb +61 -0
- data/tests/test_ltp.rb +188 -0
- data/tests/test_ltp2.rb +320 -0
- data/tests/test_next_tick.rb +109 -0
- data/tests/test_processes.rb +95 -0
- data/tests/test_pure.rb +129 -0
- data/tests/test_running.rb +47 -0
- data/tests/test_sasl.rb +74 -0
- data/tests/test_send_file.rb +243 -0
- data/tests/test_servers.rb +80 -0
- data/tests/test_smtpclient.rb +83 -0
- data/tests/test_smtpserver.rb +93 -0
- data/tests/test_spawn.rb +329 -0
- data/tests/test_ssl_args.rb +68 -0
- data/tests/test_ssl_methods.rb +50 -0
- data/tests/test_timers.rb +148 -0
- data/tests/test_ud.rb +43 -0
- data/tests/testem.rb +31 -0
- data/web/whatis +7 -0
- metadata +214 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
/**
|
2
|
+
* $Id$
|
3
|
+
*
|
4
|
+
* Author:: Francis Cianfrocca (gmail: blackhedd)
|
5
|
+
* Homepage:: http://rubyeventmachine.com
|
6
|
+
* Date:: 15 Jul 2007
|
7
|
+
*
|
8
|
+
* See EventMachine and EventMachine::Connection for documentation and
|
9
|
+
* usage examples.
|
10
|
+
*
|
11
|
+
*
|
12
|
+
*----------------------------------------------------------------------------
|
13
|
+
*
|
14
|
+
* Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
15
|
+
* Gmail: blackhedd
|
16
|
+
*
|
17
|
+
* This program is free software; you can redistribute it and/or modify
|
18
|
+
* it under the terms of either: 1) the GNU General Public License
|
19
|
+
* as published by the Free Software Foundation; either version 2 of the
|
20
|
+
* License, or (at your option) any later version; or 2) Ruby's License.
|
21
|
+
*
|
22
|
+
* See the file COPYING for complete licensing information.
|
23
|
+
*
|
24
|
+
*---------------------------------------------------------------------------
|
25
|
+
*
|
26
|
+
*
|
27
|
+
*/
|
28
|
+
|
29
|
+
|
30
|
+
package com.rubyeventmachine;
|
31
|
+
|
32
|
+
public class Timer {
|
33
|
+
/**
|
34
|
+
* User code is expected to call a method on a controlling Application,
|
35
|
+
* which will fill in this field so subsequent user code can access it.
|
36
|
+
*/
|
37
|
+
public Application application;
|
38
|
+
public double interval;
|
39
|
+
|
40
|
+
/**
|
41
|
+
* The reactor calls here, and it may be overridden in subclasses.
|
42
|
+
* User code should never call this method.
|
43
|
+
*/
|
44
|
+
public void _fire() {
|
45
|
+
fire();
|
46
|
+
}
|
47
|
+
|
48
|
+
/**
|
49
|
+
* User code is expected to override this method.
|
50
|
+
*/
|
51
|
+
public void fire() {
|
52
|
+
}
|
53
|
+
|
54
|
+
}
|
@@ -0,0 +1,108 @@
|
|
1
|
+
/**
|
2
|
+
* $Id$
|
3
|
+
*
|
4
|
+
* Author:: Francis Cianfrocca (gmail: blackhedd)
|
5
|
+
* Homepage:: http://rubyeventmachine.com
|
6
|
+
* Date:: 15 Jul 2007
|
7
|
+
*
|
8
|
+
* See EventMachine and EventMachine::Connection for documentation and
|
9
|
+
* usage examples.
|
10
|
+
*
|
11
|
+
*
|
12
|
+
*----------------------------------------------------------------------------
|
13
|
+
*
|
14
|
+
* Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
15
|
+
* Gmail: blackhedd
|
16
|
+
*
|
17
|
+
* This program is free software; you can redistribute it and/or modify
|
18
|
+
* it under the terms of either: 1) the GNU General Public License
|
19
|
+
* as published by the Free Software Foundation; either version 2 of the
|
20
|
+
* License, or (at your option) any later version; or 2) Ruby's License.
|
21
|
+
*
|
22
|
+
* See the file COPYING for complete licensing information.
|
23
|
+
*
|
24
|
+
*---------------------------------------------------------------------------
|
25
|
+
*
|
26
|
+
*
|
27
|
+
*/
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
package com.rubyeventmachine.tests;
|
32
|
+
|
33
|
+
|
34
|
+
import org.junit.After;
|
35
|
+
import org.junit.AfterClass;
|
36
|
+
import org.junit.Before;
|
37
|
+
import org.junit.BeforeClass;
|
38
|
+
import org.junit.Test;
|
39
|
+
import org.junit.Assert;
|
40
|
+
import java.net.*;
|
41
|
+
import java.io.*;
|
42
|
+
import java.nio.*;
|
43
|
+
|
44
|
+
import com.rubyeventmachine.*;
|
45
|
+
|
46
|
+
public class ApplicationTest {
|
47
|
+
|
48
|
+
@BeforeClass
|
49
|
+
public static void setUpBeforeClass() throws Exception {
|
50
|
+
}
|
51
|
+
|
52
|
+
@AfterClass
|
53
|
+
public static void tearDownAfterClass() throws Exception {
|
54
|
+
}
|
55
|
+
|
56
|
+
@Before
|
57
|
+
public void setUp() throws Exception {
|
58
|
+
}
|
59
|
+
|
60
|
+
@After
|
61
|
+
public void tearDown() throws Exception {
|
62
|
+
}
|
63
|
+
|
64
|
+
@Test
|
65
|
+
public void testRunnableArgument() {
|
66
|
+
final Application a = new Application();
|
67
|
+
a.run (new Runnable() {
|
68
|
+
public void run() {
|
69
|
+
a.stop();
|
70
|
+
}
|
71
|
+
});
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
class F implements ConnectionFactory {
|
77
|
+
public Connection connection() {
|
78
|
+
return new Connection() {
|
79
|
+
public void receiveData (ByteBuffer bb) {
|
80
|
+
application.stop();
|
81
|
+
}
|
82
|
+
};
|
83
|
+
}
|
84
|
+
|
85
|
+
};
|
86
|
+
|
87
|
+
@Test
|
88
|
+
public void testTcpServer() throws EmReactorException {
|
89
|
+
final Application a = new Application();
|
90
|
+
final SocketAddress saddr = new InetSocketAddress ("127.0.0.1", 9008);
|
91
|
+
a.run (new Runnable() {
|
92
|
+
public void run() {
|
93
|
+
try {
|
94
|
+
a.startServer (saddr, new F());
|
95
|
+
} catch (EmReactorException e) { Assert.fail(); }
|
96
|
+
new Thread() {
|
97
|
+
public void run() {
|
98
|
+
try {
|
99
|
+
Socket s = new Socket ("127.0.0.1", 9008);
|
100
|
+
s.getOutputStream().write(new String ("boo").getBytes());
|
101
|
+
} catch (UnknownHostException e) {
|
102
|
+
} catch (IOException e) {}
|
103
|
+
}
|
104
|
+
}.start();
|
105
|
+
}
|
106
|
+
});
|
107
|
+
}
|
108
|
+
}
|
@@ -0,0 +1,124 @@
|
|
1
|
+
/**
|
2
|
+
* $Id$
|
3
|
+
*
|
4
|
+
* Author:: Francis Cianfrocca (gmail: blackhedd)
|
5
|
+
* Homepage:: http://rubyeventmachine.com
|
6
|
+
* Date:: 15 Jul 2007
|
7
|
+
*
|
8
|
+
* See EventMachine and EventMachine::Connection for documentation and
|
9
|
+
* usage examples.
|
10
|
+
*
|
11
|
+
*
|
12
|
+
*----------------------------------------------------------------------------
|
13
|
+
*
|
14
|
+
* Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
15
|
+
* Gmail: blackhedd
|
16
|
+
*
|
17
|
+
* This program is free software; you can redistribute it and/or modify
|
18
|
+
* it under the terms of either: 1) the GNU General Public License
|
19
|
+
* as published by the Free Software Foundation; either version 2 of the
|
20
|
+
* License, or (at your option) any later version; or 2) Ruby's License.
|
21
|
+
*
|
22
|
+
* See the file COPYING for complete licensing information.
|
23
|
+
*
|
24
|
+
*---------------------------------------------------------------------------
|
25
|
+
*
|
26
|
+
*
|
27
|
+
*/
|
28
|
+
|
29
|
+
|
30
|
+
package com.rubyeventmachine.tests;
|
31
|
+
|
32
|
+
|
33
|
+
import org.junit.After;
|
34
|
+
import org.junit.AfterClass;
|
35
|
+
import org.junit.Before;
|
36
|
+
import org.junit.BeforeClass;
|
37
|
+
import org.junit.Test;
|
38
|
+
import java.io.*;
|
39
|
+
import java.nio.*;
|
40
|
+
import java.nio.channels.*;
|
41
|
+
|
42
|
+
import com.rubyeventmachine.*;
|
43
|
+
|
44
|
+
public class ConnectTest {
|
45
|
+
|
46
|
+
@BeforeClass
|
47
|
+
public static void setUpBeforeClass() throws Exception {
|
48
|
+
}
|
49
|
+
|
50
|
+
@AfterClass
|
51
|
+
public static void tearDownAfterClass() throws Exception {
|
52
|
+
}
|
53
|
+
|
54
|
+
@Before
|
55
|
+
public void setUp() throws Exception {
|
56
|
+
}
|
57
|
+
|
58
|
+
@After
|
59
|
+
public void tearDown() throws Exception {
|
60
|
+
}
|
61
|
+
|
62
|
+
@Test
|
63
|
+
public final void test1() throws IOException, ClosedChannelException {
|
64
|
+
Application a = new Application();
|
65
|
+
a.addTimer(0, new Timer() {
|
66
|
+
public void fire() {
|
67
|
+
application.connect("www.bayshorenetworks.com", 80, new Connection() {
|
68
|
+
public void connectionCompleted() {
|
69
|
+
close();
|
70
|
+
}
|
71
|
+
public void unbind() {
|
72
|
+
application.stop();
|
73
|
+
}
|
74
|
+
});
|
75
|
+
}
|
76
|
+
});
|
77
|
+
a.run();
|
78
|
+
}
|
79
|
+
|
80
|
+
@Test
|
81
|
+
public final void test2() throws IOException {
|
82
|
+
class Bays extends Connection {
|
83
|
+
public void connectionCompleted() {
|
84
|
+
sendData (ByteBuffer.wrap( new String ("GET / HTTP/1.1\r\nHost: _\r\n\r\n").getBytes()));
|
85
|
+
}
|
86
|
+
public void receiveData (ByteBuffer b) {
|
87
|
+
System.out.println (new String(b.array()));
|
88
|
+
application.stop();
|
89
|
+
}
|
90
|
+
};
|
91
|
+
|
92
|
+
Application a = new Application();
|
93
|
+
a.addTimer(0, new Timer() {
|
94
|
+
public void fire() {
|
95
|
+
application.connect("www.bayshorenetworks.com", 80, new Bays());
|
96
|
+
}
|
97
|
+
});
|
98
|
+
a.run();
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
class C1 extends Connection {
|
104
|
+
Application application;
|
105
|
+
public C1 (Application a) {
|
106
|
+
application = a;
|
107
|
+
}
|
108
|
+
public void postInit() {
|
109
|
+
application.stop();
|
110
|
+
}
|
111
|
+
}
|
112
|
+
@Test
|
113
|
+
public final void test3() {
|
114
|
+
final Application a = new Application();
|
115
|
+
a.run (new Runnable() {
|
116
|
+
public void run() {
|
117
|
+
a.connect("www.bayshorenetworks.com", 80, new C1(a));
|
118
|
+
}
|
119
|
+
});
|
120
|
+
}
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
/**
|
2
|
+
* $Id$
|
3
|
+
*
|
4
|
+
* Author:: Francis Cianfrocca (gmail: blackhedd)
|
5
|
+
* Homepage:: http://rubyeventmachine.com
|
6
|
+
* Date:: 15 Jul 2007
|
7
|
+
*
|
8
|
+
* See EventMachine and EventMachine::Connection for documentation and
|
9
|
+
* usage examples.
|
10
|
+
*
|
11
|
+
*
|
12
|
+
*----------------------------------------------------------------------------
|
13
|
+
*
|
14
|
+
* Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
15
|
+
* Gmail: blackhedd
|
16
|
+
*
|
17
|
+
* This program is free software; you can redistribute it and/or modify
|
18
|
+
* it under the terms of either: 1) the GNU General Public License
|
19
|
+
* as published by the Free Software Foundation; either version 2 of the
|
20
|
+
* License, or (at your option) any later version; or 2) Ruby's License.
|
21
|
+
*
|
22
|
+
* See the file COPYING for complete licensing information.
|
23
|
+
*
|
24
|
+
*---------------------------------------------------------------------------
|
25
|
+
*
|
26
|
+
*
|
27
|
+
*/
|
28
|
+
|
29
|
+
|
30
|
+
package com.rubyeventmachine.tests;
|
31
|
+
|
32
|
+
//import static org.junit.Assert.*;
|
33
|
+
|
34
|
+
import org.junit.After;
|
35
|
+
import org.junit.AfterClass;
|
36
|
+
import org.junit.Before;
|
37
|
+
import org.junit.BeforeClass;
|
38
|
+
import org.junit.Test;
|
39
|
+
|
40
|
+
import com.rubyeventmachine.EmReactor;
|
41
|
+
|
42
|
+
import java.io.*;
|
43
|
+
import java.nio.*;
|
44
|
+
|
45
|
+
|
46
|
+
public class EMTest {
|
47
|
+
|
48
|
+
class ShortTimer extends EmReactor {
|
49
|
+
public void eventCallback (String sig, int eventCode, ByteBuffer data) {
|
50
|
+
System.out.println ("Short Callback "+sig+" "+eventCode+" "+data);
|
51
|
+
this.stop();
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
@BeforeClass
|
56
|
+
public static void setUpBeforeClass() throws Exception {
|
57
|
+
}
|
58
|
+
|
59
|
+
@AfterClass
|
60
|
+
public static void tearDownAfterClass() throws Exception {
|
61
|
+
}
|
62
|
+
|
63
|
+
@Before
|
64
|
+
public void setUp() throws Exception {
|
65
|
+
}
|
66
|
+
|
67
|
+
@After
|
68
|
+
public void tearDown() throws Exception {
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
@Test
|
73
|
+
public final void testOneShort() throws IOException {
|
74
|
+
EmReactor em = new ShortTimer();
|
75
|
+
em.installOneshotTimer(1050);
|
76
|
+
em.run();
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
package com.rubyeventmachine.tests;
|
2
|
+
|
3
|
+
import com.rubyeventmachine.*;
|
4
|
+
import java.net.*;
|
5
|
+
import java.nio.*;
|
6
|
+
|
7
|
+
import org.junit.After;
|
8
|
+
import org.junit.AfterClass;
|
9
|
+
import org.junit.Before;
|
10
|
+
import org.junit.BeforeClass;
|
11
|
+
import org.junit.Test;
|
12
|
+
|
13
|
+
|
14
|
+
public class TestDatagrams {
|
15
|
+
|
16
|
+
@BeforeClass
|
17
|
+
public static void setUpBeforeClass() throws Exception {
|
18
|
+
}
|
19
|
+
|
20
|
+
@AfterClass
|
21
|
+
public static void tearDownAfterClass() throws Exception {
|
22
|
+
}
|
23
|
+
|
24
|
+
@Before
|
25
|
+
public void setUp() throws Exception {
|
26
|
+
}
|
27
|
+
|
28
|
+
@After
|
29
|
+
public void tearDown() throws Exception {
|
30
|
+
}
|
31
|
+
|
32
|
+
class A extends Connection {
|
33
|
+
public void receiveData (ByteBuffer bb) {
|
34
|
+
application.stop();
|
35
|
+
}
|
36
|
+
}
|
37
|
+
class B extends Connection {
|
38
|
+
public void postInit() {
|
39
|
+
this.sendDatagram(ByteBuffer.wrap(new String("ABC").getBytes()), new InetSocketAddress ("127.0.0.1", 9550));
|
40
|
+
}
|
41
|
+
|
42
|
+
}
|
43
|
+
@Test
|
44
|
+
public final void testA() {
|
45
|
+
final Application a = new Application();
|
46
|
+
a.run (new Runnable() {
|
47
|
+
public void run() {
|
48
|
+
a.openDatagramSocket( new InetSocketAddress ("0.0.0.0", 9550), new A() );
|
49
|
+
a.openDatagramSocket( new B() );
|
50
|
+
}
|
51
|
+
});
|
52
|
+
}
|
53
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
/**
|
2
|
+
* $Id$
|
3
|
+
*
|
4
|
+
* Author:: Francis Cianfrocca (gmail: blackhedd)
|
5
|
+
* Homepage:: http://rubyeventmachine.com
|
6
|
+
* Date:: 15 Jul 2007
|
7
|
+
*
|
8
|
+
* See EventMachine and EventMachine::Connection for documentation and
|
9
|
+
* usage examples.
|
10
|
+
*
|
11
|
+
*
|
12
|
+
*----------------------------------------------------------------------------
|
13
|
+
*
|
14
|
+
* Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
15
|
+
* Gmail: blackhedd
|
16
|
+
*
|
17
|
+
* This program is free software; you can redistribute it and/or modify
|
18
|
+
* it under the terms of either: 1) the GNU General Public License
|
19
|
+
* as published by the Free Software Foundation; either version 2 of the
|
20
|
+
* License, or (at your option) any later version; or 2) Ruby's License.
|
21
|
+
*
|
22
|
+
* See the file COPYING for complete licensing information.
|
23
|
+
*
|
24
|
+
*---------------------------------------------------------------------------
|
25
|
+
*
|
26
|
+
*
|
27
|
+
*/
|
28
|
+
|
29
|
+
|
30
|
+
package com.rubyeventmachine.tests;
|
31
|
+
|
32
|
+
|
33
|
+
import com.rubyeventmachine.*;
|
34
|
+
import java.net.*;
|
35
|
+
import org.junit.After;
|
36
|
+
import org.junit.AfterClass;
|
37
|
+
import org.junit.Before;
|
38
|
+
import org.junit.BeforeClass;
|
39
|
+
import org.junit.Test;
|
40
|
+
import org.junit.Assert;
|
41
|
+
|
42
|
+
public class TestServers {
|
43
|
+
|
44
|
+
@BeforeClass
|
45
|
+
public static void setUpBeforeClass() throws Exception {
|
46
|
+
}
|
47
|
+
|
48
|
+
@AfterClass
|
49
|
+
public static void tearDownAfterClass() throws Exception {
|
50
|
+
}
|
51
|
+
|
52
|
+
@Before
|
53
|
+
public void setUp() throws Exception {
|
54
|
+
}
|
55
|
+
|
56
|
+
@After
|
57
|
+
public void tearDown() throws Exception {
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
@Test
|
62
|
+
public void testBadServerAddress() {
|
63
|
+
final Application a = new Application();
|
64
|
+
a.run (new Runnable() {
|
65
|
+
public void run() {
|
66
|
+
try {
|
67
|
+
a.startServer(new InetSocketAddress ("100.100.100.100", 100), new DefaultConnectionFactory());
|
68
|
+
Assert.fail ("was supposed to throw a reactor exception");
|
69
|
+
} catch (EmReactorException e) {}
|
70
|
+
a.stop();
|
71
|
+
}
|
72
|
+
});
|
73
|
+
}
|
74
|
+
}
|