stomper 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -0
- data/{spec/spec.opts → .rspec} +0 -2
- data/Gemfile +4 -0
- data/LICENSE +201 -201
- data/README.md +130 -0
- data/Rakefile +5 -0
- data/examples/basic.rb +38 -0
- data/examples/events.rb +54 -0
- data/features/acking_messages.feature +147 -0
- data/features/disconnecting.feature +12 -0
- data/features/establish_connection.feature +44 -0
- data/features/protocol_version_negotiation.feature +61 -0
- data/features/receipts.feature +72 -0
- data/features/scopes.feature +32 -0
- data/features/secure_connections.feature +38 -0
- data/features/send_and_message.feature +28 -0
- data/features/steps/acking_messages_steps.rb +39 -0
- data/features/steps/disconnecting_steps.rb +8 -0
- data/features/steps/establish_connection_steps.rb +74 -0
- data/features/steps/frame_transmission_steps.rb +35 -0
- data/features/steps/protocol_version_negotiation_steps.rb +15 -0
- data/features/steps/receipts_steps.rb +79 -0
- data/features/steps/scopes_steps.rb +52 -0
- data/features/steps/secure_connections_steps.rb +41 -0
- data/features/steps/send_and_message_steps.rb +35 -0
- data/features/steps/subscribing_steps.rb +36 -0
- data/features/steps/threaded_receiver_steps.rb +8 -0
- data/features/steps/transactions_steps.rb +0 -0
- data/features/subscribing.feature +151 -0
- data/features/support/env.rb +11 -0
- data/features/support/header_helpers.rb +12 -0
- data/features/support/ssl/README +6 -0
- data/features/support/ssl/broker_cert.csr +17 -0
- data/features/support/ssl/broker_cert.pem +72 -0
- data/features/support/ssl/broker_key.pem +27 -0
- data/features/support/ssl/client_cert.csr +17 -0
- data/features/support/ssl/client_cert.pem +72 -0
- data/features/support/ssl/client_key.pem +27 -0
- data/features/support/ssl/demoCA/cacert.pem +17 -0
- data/features/support/ssl/demoCA/index.txt +2 -0
- data/features/support/ssl/demoCA/index.txt.attr +1 -0
- data/features/support/ssl/demoCA/index.txt.attr.old +1 -0
- data/features/support/ssl/demoCA/index.txt.old +1 -0
- data/features/support/ssl/demoCA/newcerts/01.pem +72 -0
- data/features/support/ssl/demoCA/newcerts/02.pem +72 -0
- data/features/support/ssl/demoCA/private/cakey.pem +17 -0
- data/features/support/ssl/demoCA/serial +1 -0
- data/features/support/ssl/demoCA/serial.old +1 -0
- data/features/support/test_stomp_server.rb +150 -0
- data/features/threaded_receiver.feature +11 -0
- data/features/transactions.feature +66 -0
- data/lib/stomper.rb +30 -20
- data/lib/stomper/connection.rb +442 -102
- data/lib/stomper/errors.rb +59 -0
- data/lib/stomper/extensions.rb +10 -0
- data/lib/stomper/extensions/common.rb +258 -0
- data/lib/stomper/extensions/events.rb +213 -0
- data/lib/stomper/extensions/heartbeat.rb +101 -0
- data/lib/stomper/extensions/scoping.rb +56 -0
- data/lib/stomper/frame.rb +54 -0
- data/lib/stomper/frame_serializer.rb +217 -0
- data/lib/stomper/headers.rb +15 -0
- data/lib/stomper/receipt_manager.rb +36 -0
- data/lib/stomper/receivers.rb +7 -0
- data/lib/stomper/receivers/threaded.rb +71 -0
- data/lib/stomper/scopes.rb +9 -0
- data/lib/stomper/scopes/header_scope.rb +49 -0
- data/lib/stomper/scopes/receipt_scope.rb +44 -0
- data/lib/stomper/scopes/transaction_scope.rb +109 -0
- data/lib/stomper/sockets.rb +66 -28
- data/lib/stomper/subscription_manager.rb +79 -0
- data/lib/stomper/support.rb +68 -0
- data/lib/stomper/support/1.8/frame_serializer.rb +53 -0
- data/lib/stomper/support/1.8/headers.rb +183 -0
- data/lib/stomper/support/1.9/frame_serializer.rb +64 -0
- data/lib/stomper/support/1.9/headers.rb +172 -0
- data/lib/stomper/support/ruby.rb +13 -0
- data/lib/stomper/uris.rb +49 -0
- data/lib/stomper/version.rb +7 -0
- data/spec/spec_helper.rb +13 -9
- data/spec/stomper/connection_spec.rb +712 -0
- data/spec/stomper/extensions/common_spec.rb +187 -0
- data/spec/stomper/extensions/events_spec.rb +78 -0
- data/spec/stomper/extensions/heartbeat_spec.rb +103 -0
- data/spec/stomper/extensions/scoping_spec.rb +21 -0
- data/spec/stomper/frame_serializer_1.8_spec.rb +318 -0
- data/spec/stomper/frame_serializer_spec.rb +316 -0
- data/spec/stomper/frame_spec.rb +36 -0
- data/spec/stomper/headers_spec.rb +224 -0
- data/spec/stomper/receipt_manager_spec.rb +91 -0
- data/spec/stomper/receivers/threaded_spec.rb +116 -0
- data/spec/stomper/scopes/header_scope_spec.rb +42 -0
- data/spec/stomper/scopes/receipt_scope_spec.rb +51 -0
- data/spec/stomper/scopes/transaction_scope_spec.rb +183 -0
- data/spec/stomper/sockets_spec.rb +113 -0
- data/spec/stomper/subscription_manager_spec.rb +107 -0
- data/spec/stomper/support_spec.rb +69 -0
- data/spec/stomper/uris_spec.rb +54 -0
- data/spec/stomper_spec.rb +9 -0
- data/spec/support/custom_argument_matchers.rb +57 -0
- data/spec/support/existential_frame_matchers.rb +19 -0
- data/spec/support/frame_header_matchers.rb +10 -0
- data/stomper.gemspec +30 -0
- metadata +272 -97
- data/AUTHORS +0 -21
- data/CHANGELOG +0 -20
- data/README.rdoc +0 -120
- data/lib/stomper/client.rb +0 -34
- data/lib/stomper/frame_reader.rb +0 -73
- data/lib/stomper/frame_writer.rb +0 -21
- data/lib/stomper/frames.rb +0 -39
- data/lib/stomper/frames/abort.rb +0 -10
- data/lib/stomper/frames/ack.rb +0 -25
- data/lib/stomper/frames/begin.rb +0 -11
- data/lib/stomper/frames/client_frame.rb +0 -89
- data/lib/stomper/frames/commit.rb +0 -10
- data/lib/stomper/frames/connect.rb +0 -10
- data/lib/stomper/frames/connected.rb +0 -30
- data/lib/stomper/frames/disconnect.rb +0 -10
- data/lib/stomper/frames/error.rb +0 -21
- data/lib/stomper/frames/message.rb +0 -48
- data/lib/stomper/frames/receipt.rb +0 -19
- data/lib/stomper/frames/send.rb +0 -10
- data/lib/stomper/frames/server_frame.rb +0 -38
- data/lib/stomper/frames/subscribe.rb +0 -42
- data/lib/stomper/frames/unsubscribe.rb +0 -19
- data/lib/stomper/open_uri_interface.rb +0 -41
- data/lib/stomper/receipt_handlers.rb +0 -23
- data/lib/stomper/receiptor.rb +0 -38
- data/lib/stomper/subscriber.rb +0 -76
- data/lib/stomper/subscription.rb +0 -128
- data/lib/stomper/subscriptions.rb +0 -95
- data/lib/stomper/threaded_receiver.rb +0 -59
- data/lib/stomper/transaction.rb +0 -185
- data/lib/stomper/transactor.rb +0 -50
- data/lib/stomper/uri.rb +0 -55
- data/spec/client_spec.rb +0 -29
- data/spec/connection_spec.rb +0 -22
- data/spec/frame_reader_spec.rb +0 -37
- data/spec/frame_writer_spec.rb +0 -27
- data/spec/frames/client_frame_spec.rb +0 -66
- data/spec/frames/indirect_frame_spec.rb +0 -45
- data/spec/frames/server_frame_spec.rb +0 -85
- data/spec/open_uri_interface_spec.rb +0 -132
- data/spec/receiptor_spec.rb +0 -35
- data/spec/shared_connection_examples.rb +0 -79
- data/spec/subscriber_spec.rb +0 -77
- data/spec/subscription_spec.rb +0 -157
- data/spec/subscriptions_spec.rb +0 -145
- data/spec/threaded_receiver_spec.rb +0 -33
- data/spec/transaction_spec.rb +0 -139
- data/spec/transactor_spec.rb +0 -46
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIEogIBAAKCAQEAr2Kt6gsrPaYO40qytboypatf8vBagyJM/wWdviW7aGH1Vi4i
|
3
|
+
nCv5O6KXN6o3F0DNEpd2cxkkxVl4RUVdK5zf6dJW11y5ylNzoWJw31Kv+31rt2h6
|
4
|
+
CGjoSqta6eakzTidLlVREUg8K1eoVTdCEQzpLOd500zILp6SStyLZnm/YuB1Sdc3
|
5
|
+
Yk46R3rAL3WMKHBQiCSueusvpndgZHcN4sJO5WIF+icgXFNygBbmr/U1WqlqX2AF
|
6
|
+
Ktj+qaQtqsSBNfxRinyfDEDqQGGH7ApgOUQusPZ3eQG2vxXSZc1q5CEFWVPZauc3
|
7
|
+
6s6jsc/DcPwsQD0Sv/mEMsqDxuU9qij/eJ0DFwI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|
+
TBXP/VFsKYbHGYmA57GQzcaaXqptvQq7fuqsfgxqr82w83K7AgMBAAGjUDBOMB0G
|
12
|
+
A1UdDgQWBBR8T1C/xleXa9kc8ZLvtWZHlHkVdDAfBgNVHSMEGDAWgBR8T1C/xleX
|
13
|
+
a9kc8ZLvtWZHlHkVdDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAArO
|
14
|
+
OvHvpbafdbxqVv6R9vch06hbPdtVh5pcM2AsNGfn3MhD9VmIAkrPgbVHHN8d9lFS
|
15
|
+
MVZbnyGtkiJoZTlJV9tPD4Nq/aGSePu+U4gtFNRmD+wvh5VREcrOloqN4lX8/h2N
|
16
|
+
aFMdwQa7qRZ40L/4RLslb5ZsiiFihbk9pY+AOD+d
|
17
|
+
-----END CERTIFICATE-----
|
@@ -0,0 +1 @@
|
|
1
|
+
unique_subject = yes
|
@@ -0,0 +1 @@
|
|
1
|
+
unique_subject = yes
|
@@ -0,0 +1 @@
|
|
1
|
+
V 210218165001Z 01 unknown /C=US/ST=Nowheres/O=Stomper Testing/OU=SSL Testing/CN=My Broker
|
@@ -0,0 +1,72 @@
|
|
1
|
+
Certificate:
|
2
|
+
Data:
|
3
|
+
Version: 3 (0x2)
|
4
|
+
Serial Number: 1 (0x1)
|
5
|
+
Signature Algorithm: sha1WithRSAEncryption
|
6
|
+
Issuer: C=US, ST=Nowheres, L=Stomper, O=Stomper Testing, OU=CA Testing, CN=Stomper CA
|
7
|
+
Validity
|
8
|
+
Not Before: Feb 21 16:50:01 2011 GMT
|
9
|
+
Not After : Feb 18 16:50:01 2021 GMT
|
10
|
+
Subject: C=US, ST=Nowheres, O=Stomper Testing, OU=SSL Testing, CN=My Broker
|
11
|
+
Subject Public Key Info:
|
12
|
+
Public Key Algorithm: rsaEncryption
|
13
|
+
Public-Key: (2048 bit)
|
14
|
+
Modulus:
|
15
|
+
00:eb:dd:be:2d:87:54:13:ce:4c:e1:bd:c9:c8:e0:
|
16
|
+
18:b0:50:f1:30:c8:6e:22:7a:bc:c6:ea:3f:e2:c4:
|
17
|
+
24:d9:8c:41:94:54:d4:e0:7b:5c:6c:dd:bd:41:8f:
|
18
|
+
bd:aa:98:c2:f0:e9:13:7e:36:5a:97:57:e4:6a:04:
|
19
|
+
08:aa:12:2b:68:4b:9d:5a:40:92:41:57:5b:2e:d2:
|
20
|
+
e1:f4:f8:c4:31:dd:6c:2d:4c:12:ab:80:72:71:39:
|
21
|
+
4e:aa:14:b8:f6:35:e8:07:9f:a2:a3:b8:a6:08:8d:
|
22
|
+
60:d5:53:01:38:8c:aa:17:e9:b0:b3:8c:e3:d9:4d:
|
23
|
+
14:02:da:9a:ff:6f:5b:65:ba:c3:56:80:b0:de:8e:
|
24
|
+
c8:25:3f:1b:a0:ac:80:1c:38:e0:77:4e:c6:5d:92:
|
25
|
+
44:97:c3:f8:ba:9a:02:83:a8:1b:57:3b:38:d6:7d:
|
26
|
+
7f:95:86:f4:c2:de:51:d0:ee:a1:30:b4:39:9a:f6:
|
27
|
+
58:03:62:93:94:a5:72:72:a2:5c:7e:cf:54:7f:57:
|
28
|
+
92:46:f8:f7:b1:79:56:20:bd:95:25:d5:11:5d:c0:
|
29
|
+
5c:c7:cd:cf:44:8f:88:68:e1:6f:c0:ca:2e:db:fc:
|
30
|
+
d0:19:82:36:b1:3f:20:82:df:ce:a6:55:44:02:51:
|
31
|
+
8b:6c:4f:a1:26:b3:41:e8:0b:a8:0c:8f:67:65:92:
|
32
|
+
ee:df
|
33
|
+
Exponent: 65537 (0x10001)
|
34
|
+
X509v3 extensions:
|
35
|
+
X509v3 Basic Constraints:
|
36
|
+
CA:FALSE
|
37
|
+
Netscape Comment:
|
38
|
+
OpenSSL Generated Certificate
|
39
|
+
X509v3 Subject Key Identifier:
|
40
|
+
5C:28:4D:B8:A3:D7:CB:43:2C:1C:DB:0F:7B:75:99:85:44:4E:D8:A1
|
41
|
+
X509v3 Authority Key Identifier:
|
42
|
+
keyid:7C:4F:50:BF:C6:57:97:6B:D9:1C:F1:92:EF:B5:66:47:94:79:15:74
|
43
|
+
|
44
|
+
Signature Algorithm: sha1WithRSAEncryption
|
45
|
+
51:2f:da:d1:a4:9f:97:77:00:69:bb:04:85:34:75:bd:2e:ad:
|
46
|
+
45:83:a7:95:f1:83:5d:52:1e:65:79:ee:5b:a0:f5:7b:82:53:
|
47
|
+
88:c3:fc:89:c8:4f:68:4e:80:8a:cb:53:4f:44:a8:6d:8c:be:
|
48
|
+
be:74:19:ff:75:52:14:3b:70:42:87:cf:fc:90:58:7e:c9:cd:
|
49
|
+
d4:a2:b8:15:74:e8:51:ce:9c:73:ca:a5:29:76:4a:f3:a4:26:
|
50
|
+
f3:70:c5:8e:5f:cf:fe:7d:81:de:43:9e:36:c0:87:7b:66:02:
|
51
|
+
7f:02:2d:64:48:19:be:74:4a:27:cd:c5:56:c5:ff:96:1a:02:
|
52
|
+
3a:2f
|
53
|
+
-----BEGIN CERTIFICATE-----
|
54
|
+
MIIDTzCCArigAwIBAgIBATANBgkqhkiG9w0BAQUFADB2MQswCQYDVQQGEwJVUzER
|
55
|
+
MA8GA1UECAwITm93aGVyZXMxEDAOBgNVBAcMB1N0b21wZXIxGDAWBgNVBAoMD1N0
|
56
|
+
b21wZXIgVGVzdGluZzETMBEGA1UECwwKQ0EgVGVzdGluZzETMBEGA1UEAwwKU3Rv
|
57
|
+
bXBlciBDQTAeFw0xMTAyMjExNjUwMDFaFw0yMTAyMTgxNjUwMDFaMGQxCzAJBgNV
|
58
|
+
BAYTAlVTMREwDwYDVQQIDAhOb3doZXJlczEYMBYGA1UECgwPU3RvbXBlciBUZXN0
|
59
|
+
aW5nMRQwEgYDVQQLDAtTU0wgVGVzdGluZzESMBAGA1UEAwwJTXkgQnJva2VyMIIB
|
60
|
+
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA692+LYdUE85M4b3JyOAYsFDx
|
61
|
+
MMhuInq8xuo/4sQk2YxBlFTU4HtcbN29QY+9qpjC8OkTfjZal1fkagQIqhIraEud
|
62
|
+
WkCSQVdbLtLh9PjEMd1sLUwSq4BycTlOqhS49jXoB5+io7imCI1g1VMBOIyqF+mw
|
63
|
+
s4zj2U0UAtqa/29bZbrDVoCw3o7IJT8boKyAHDjgd07GXZJEl8P4upoCg6gbVzs4
|
64
|
+
1n1/lYb0wt5R0O6hMLQ5mvZYA2KTlKVycqJcfs9Uf1eSRvj3sXlWIL2VJdURXcBc
|
65
|
+
x83PRI+IaOFvwMou2/zQGYI2sT8ggt/OplVEAlGLbE+hJrNB6AuoDI9nZZLu3wID
|
66
|
+
AQABo3sweTAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVy
|
67
|
+
YXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUXChNuKPXy0MsHNsPe3WZhURO2KEw
|
68
|
+
HwYDVR0jBBgwFoAUfE9Qv8ZXl2vZHPGS77VmR5R5FXQwDQYJKoZIhvcNAQEFBQAD
|
69
|
+
gYEAUS/a0aSfl3cAabsEhTR1vS6tRYOnlfGDXVIeZXnuW6D1e4JTiMP8ichPaE6A
|
70
|
+
istTT0SobYy+vnQZ/3VSFDtwQofP/JBYfsnN1KK4FXToUc6cc8qlKXZK86Qm83DF
|
71
|
+
jl/P/n2B3kOeNsCHe2YCfwItZEgZvnRKJ83FVsX/lhoCOi8=
|
72
|
+
-----END CERTIFICATE-----
|
@@ -0,0 +1,72 @@
|
|
1
|
+
Certificate:
|
2
|
+
Data:
|
3
|
+
Version: 3 (0x2)
|
4
|
+
Serial Number: 2 (0x2)
|
5
|
+
Signature Algorithm: sha1WithRSAEncryption
|
6
|
+
Issuer: C=US, ST=Nowheres, L=Stomper, O=Stomper Testing, OU=CA Testing, CN=Stomper CA
|
7
|
+
Validity
|
8
|
+
Not Before: Feb 21 16:57:25 2011 GMT
|
9
|
+
Not After : Feb 18 16:57:25 2021 GMT
|
10
|
+
Subject: C=US, ST=Nowheres, O=Stomper Testing, OU=SSL Testing, CN=My Client
|
11
|
+
Subject Public Key Info:
|
12
|
+
Public Key Algorithm: rsaEncryption
|
13
|
+
Public-Key: (2048 bit)
|
14
|
+
Modulus:
|
15
|
+
00:af:62:ad:ea:0b:2b:3d:a6:0e:e3:4a:b2:b5:ba:
|
16
|
+
32:a5:ab:5f:f2:f0:5a:83:22:4c:ff:05:9d:be:25:
|
17
|
+
bb:68:61:f5:56:2e:22:9c:2b:f9:3b:a2:97:37:aa:
|
18
|
+
37:17:40:cd:12:97:76:73:19:24:c5:59:78:45:45:
|
19
|
+
5d:2b:9c:df:e9:d2:56:d7:5c:b9:ca:53:73:a1:62:
|
20
|
+
70:df:52:af:fb:7d:6b:b7:68:7a:08:68:e8:4a:ab:
|
21
|
+
5a:e9:e6:a4:cd:38:9d:2e:55:51:11:48:3c:2b:57:
|
22
|
+
a8:55:37:42:11:0c:e9:2c:e7:79:d3:4c:c8:2e:9e:
|
23
|
+
92:4a:dc:8b:66:79:bf:62:e0:75:49:d7:37:62:4e:
|
24
|
+
3a:47:7a:c0:2f:75:8c:28:70:50:88:24:ae:7a:eb:
|
25
|
+
2f:a6:77:60:64:77:0d:e2:c2:4e:e5:62:05:fa:27:
|
26
|
+
20:5c:53:72:80:16:e6:af:f5:35:5a:a9:6a:5f:60:
|
27
|
+
05:2a:d8:fe:a9:a4:2d:aa:c4:81:35:fc:51:8a:7c:
|
28
|
+
9f:0c:40:ea:40:61:87:ec:0a:60:39:44:2e:b0:f6:
|
29
|
+
77:79:01:b6:bf:15:d2:65:cd:6a:e4:21:05:59:53:
|
30
|
+
d9:6a:e7:37:ea:ce:a3:b1:cf:c3:70:fc:2c:40:3d:
|
31
|
+
12:bf:f9:84:32:ca:83:c6:e5:3d:aa:28:ff:78:9d:
|
32
|
+
03:17
|
33
|
+
Exponent: 65537 (0x10001)
|
34
|
+
X509v3 extensions:
|
35
|
+
X509v3 Basic Constraints:
|
36
|
+
CA:FALSE
|
37
|
+
Netscape Comment:
|
38
|
+
OpenSSL Generated Certificate
|
39
|
+
X509v3 Subject Key Identifier:
|
40
|
+
7A:FC:5D:4F:48:8F:41:43:EA:E5:A6:14:2D:30:19:E5:63:70:43:5C
|
41
|
+
X509v3 Authority Key Identifier:
|
42
|
+
keyid:7C:4F:50:BF:C6:57:97:6B:D9:1C:F1:92:EF:B5:66:47:94:79:15:74
|
43
|
+
|
44
|
+
Signature Algorithm: sha1WithRSAEncryption
|
45
|
+
75:80:be:12:d8:7d:64:78:1f:62:97:a9:cd:0a:84:89:15:43:
|
46
|
+
ca:5b:a3:72:77:73:f1:aa:06:59:15:75:0b:1b:7d:79:c3:9f:
|
47
|
+
d5:3d:e5:70:df:64:ec:a4:27:d9:a3:49:02:b0:75:89:bd:dc:
|
48
|
+
9b:c4:79:33:14:38:93:2b:d8:3c:01:e6:d0:2a:56:06:6a:ba:
|
49
|
+
49:56:5a:f7:6c:49:dd:b0:5c:49:be:68:09:7d:75:2e:9f:49:
|
50
|
+
ed:e1:1e:49:6b:f1:cc:1c:1c:be:1e:ac:a9:ee:44:7b:15:32:
|
51
|
+
e0:b1:a6:9c:48:a4:1c:5a:55:66:0f:86:95:c0:02:e8:b7:a8:
|
52
|
+
b9:9d
|
53
|
+
-----BEGIN CERTIFICATE-----
|
54
|
+
MIIDTzCCArigAwIBAgIBAjANBgkqhkiG9w0BAQUFADB2MQswCQYDVQQGEwJVUzER
|
55
|
+
MA8GA1UECAwITm93aGVyZXMxEDAOBgNVBAcMB1N0b21wZXIxGDAWBgNVBAoMD1N0
|
56
|
+
b21wZXIgVGVzdGluZzETMBEGA1UECwwKQ0EgVGVzdGluZzETMBEGA1UEAwwKU3Rv
|
57
|
+
bXBlciBDQTAeFw0xMTAyMjExNjU3MjVaFw0yMTAyMTgxNjU3MjVaMGQxCzAJBgNV
|
58
|
+
BAYTAlVTMREwDwYDVQQIDAhOb3doZXJlczEYMBYGA1UECgwPU3RvbXBlciBUZXN0
|
59
|
+
aW5nMRQwEgYDVQQLDAtTU0wgVGV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1
|
+
03
|
@@ -0,0 +1 @@
|
|
1
|
+
02
|
@@ -0,0 +1,150 @@
|
|
1
|
+
class TestStompServer
|
2
|
+
attr_accessor :session_class
|
3
|
+
attr_reader :session
|
4
|
+
|
5
|
+
def initialize(version=nil)
|
6
|
+
@port = 61613
|
7
|
+
@socket = TCPServer.new(@port)
|
8
|
+
@session = nil
|
9
|
+
@version = version
|
10
|
+
@session_class = StompSession
|
11
|
+
end
|
12
|
+
|
13
|
+
def start
|
14
|
+
@listener = Thread.new do
|
15
|
+
begin
|
16
|
+
@session = @session_class.new(@socket.accept, @version)
|
17
|
+
rescue Exception => ex
|
18
|
+
stop
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def stop
|
24
|
+
@session.stop if @session
|
25
|
+
@socket.close rescue nil
|
26
|
+
@listener.kill rescue nil
|
27
|
+
@listener.join rescue nil
|
28
|
+
end
|
29
|
+
|
30
|
+
def force_stop
|
31
|
+
@session.force_stop if @session
|
32
|
+
@socket.close rescue nil
|
33
|
+
@listener.kill rescue nil
|
34
|
+
@listener.join rescue nil
|
35
|
+
end
|
36
|
+
|
37
|
+
def handle_client(client)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
class StompSession
|
42
|
+
attr_reader :received_frames, :sent_frames, :running
|
43
|
+
alias :running? :running
|
44
|
+
|
45
|
+
def initialize(client, version)
|
46
|
+
@client_socket = client
|
47
|
+
@received_frames = []
|
48
|
+
@sent_frames = []
|
49
|
+
@serializer = Stomper::FrameSerializer.new(@client_socket)
|
50
|
+
@running = true
|
51
|
+
@subscribed = {}
|
52
|
+
headers = {}
|
53
|
+
version && headers[:version] = version
|
54
|
+
connect_to_client(headers)
|
55
|
+
@serializer.extend_for_protocol('1.1') if version == '1.1'
|
56
|
+
@receive_thread = Thread.new do
|
57
|
+
while @running
|
58
|
+
begin
|
59
|
+
read_frame
|
60
|
+
rescue Exception => ex
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def connect_to_client(headers)
|
67
|
+
read_frame
|
68
|
+
send_frame 'CONNECTED', headers
|
69
|
+
end
|
70
|
+
|
71
|
+
def force_stop
|
72
|
+
@running = false
|
73
|
+
@client_socket.close rescue nil
|
74
|
+
@receive_thread.join rescue nil
|
75
|
+
end
|
76
|
+
|
77
|
+
def stop
|
78
|
+
Thread.pass while @running
|
79
|
+
@receive_thread.join
|
80
|
+
end
|
81
|
+
|
82
|
+
def read_frame
|
83
|
+
@serializer.read_frame.tap do |f|
|
84
|
+
@received_frames << f
|
85
|
+
unless f[:receipt].nil? || f[:receipt].empty?
|
86
|
+
send_frame 'RECEIPT', { :'receipt-id' => f[:receipt] }
|
87
|
+
end
|
88
|
+
case f.command
|
89
|
+
when 'DISCONNECT'
|
90
|
+
@running = false
|
91
|
+
@client_socket.close
|
92
|
+
when 'SEND'
|
93
|
+
if @subscribed[f[:destination]]
|
94
|
+
@subscribed[f[:destination]].each_with_index do |sub_id, idx|
|
95
|
+
msg = f.dup
|
96
|
+
msg[:subscription] = sub_id
|
97
|
+
msg[:'message-id'] = "m-#{(Time.now.to_f * 1000).to_i}-#{idx}"
|
98
|
+
msg.command = 'MESSAGE'
|
99
|
+
send_frame msg
|
100
|
+
end
|
101
|
+
end
|
102
|
+
when 'SUBSCRIBE'
|
103
|
+
@subscribed[f[:destination]] ||= []
|
104
|
+
@subscribed[f[:destination]] << f[:id]
|
105
|
+
when 'UNSUBSCRIBE'
|
106
|
+
if @subscribed[f[:destination]]
|
107
|
+
@subscribed[f[:destination]].delete f[:id]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def send_frame cmd, headers={}, body=nil
|
114
|
+
frame = cmd.is_a?(Stomper::Frame) ? cmd : Stomper::Frame.new(cmd, headers, body)
|
115
|
+
@serializer.write_frame(frame).tap do |f|
|
116
|
+
@sent_frames << f
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
class StompErrorOnConnectSession < StompSession
|
122
|
+
def connect_to_client(headers)
|
123
|
+
send_frame 'ERROR'
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
class TestSSLStompServer < TestStompServer
|
129
|
+
SSL_CERT_FILES = {
|
130
|
+
:default => {
|
131
|
+
:c => File.expand_path('../ssl/broker_cert.pem', __FILE__),
|
132
|
+
:k => File.expand_path('../ssl/broker_key.pem', __FILE__)
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
def initialize(version=nil, certs=:default)
|
137
|
+
@port = 61612
|
138
|
+
@tcp_socket = TCPServer.new(@port)
|
139
|
+
@ssl_context = OpenSSL::SSL::SSLContext.new
|
140
|
+
@ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
141
|
+
cert_files = SSL_CERT_FILES[certs]
|
142
|
+
@ssl_context.key = OpenSSL::PKey::RSA.new(File.read(cert_files[:k]))
|
143
|
+
@ssl_context.cert = OpenSSL::X509::Certificate.new(File.read(cert_files[:c]))
|
144
|
+
@socket = OpenSSL::SSL::SSLServer.new(@tcp_socket, @ssl_context)
|
145
|
+
@socket.start_immediately = true
|
146
|
+
@session = nil
|
147
|
+
@version = version
|
148
|
+
@session_class = StompSession
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Feature: Threaded receiver
|
2
|
+
In order receive frames asynchronously
|
3
|
+
As a client
|
4
|
+
I want a threaded receiver
|
5
|
+
|
6
|
+
Scenario: receiver is no longer running when an exception is raised by receive
|
7
|
+
Given a 1.1 connection between client and broker
|
8
|
+
When the broker closes the connection unexpectedly
|
9
|
+
Then after 0.2 seconds, the receiver should no longer be running
|
10
|
+
And the connection should not be connected
|
11
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
Feature: Transactions
|
2
|
+
In order to atomically transmit frames
|
3
|
+
As a client
|
4
|
+
I want transactions
|
5
|
+
|
6
|
+
Scenario: Applying a transaction to a series of frames
|
7
|
+
Given a 1.1 connection between client and broker
|
8
|
+
And a transaction scope named "t-0001"
|
9
|
+
When the client begins the transaction scope
|
10
|
+
And the client acks a message by ID "m-1234" and subscription "s-5678" within the scope
|
11
|
+
And the client nacks a message by ID "m-9012" and subscription "s-5678" within the scope
|
12
|
+
And the client aborts the transaction scope
|
13
|
+
Then the broker should have received a "BEGIN" frame with headers
|
14
|
+
| header-name | header-value |
|
15
|
+
| transaction | t-0001 |
|
16
|
+
Then the broker should have received an "ACK" frame with headers
|
17
|
+
| header-name | header-value |
|
18
|
+
| transaction | t-0001 |
|
19
|
+
| message-id | m-1234 |
|
20
|
+
| subscription | s-5678 |
|
21
|
+
And the broker should have received a "NACK" frame with headers
|
22
|
+
| header-name | header-value |
|
23
|
+
| transaction | t-0001 |
|
24
|
+
| message-id | m-9012 |
|
25
|
+
| subscription | s-5678 |
|
26
|
+
And the broker should have received an "ABORT" frame with headers
|
27
|
+
| header-name | header-value |
|
28
|
+
| transaction | t-0001 |
|
29
|
+
|
30
|
+
Scenario: Applying a transaction to a successful block
|
31
|
+
Given a 1.1 connection between client and broker
|
32
|
+
When the client executes a successful transaction block named "t-0002"
|
33
|
+
Then the broker should have received a "BEGIN" frame with headers
|
34
|
+
| header-name | header-value |
|
35
|
+
| transaction | t-0002 |
|
36
|
+
And the broker should have received an "ACK" frame with headers
|
37
|
+
| header-name | header-value |
|
38
|
+
| transaction | t-0002 |
|
39
|
+
And the broker should have received a "SEND" frame with headers
|
40
|
+
| header-name | header-value |
|
41
|
+
| transaction | t-0002 |
|
42
|
+
And the broker should have received a "NACK" frame with headers
|
43
|
+
| header-name | header-value |
|
44
|
+
| transaction | t-0002 |
|
45
|
+
And the broker should have received a "COMMIT" frame with headers
|
46
|
+
| header-name | header-value |
|
47
|
+
| transaction | t-0002 |
|
48
|
+
|
49
|
+
Scenario: Applying a transaction to an unsuccessful block
|
50
|
+
Given a 1.1 connection between client and broker
|
51
|
+
When the client executes an unsuccessful transaction block named "t-0002"
|
52
|
+
Then the broker should have received a "BEGIN" frame with headers
|
53
|
+
| header-name | header-value |
|
54
|
+
| transaction | t-0002 |
|
55
|
+
And the broker should have received an "ACK" frame with headers
|
56
|
+
| header-name | header-value |
|
57
|
+
| transaction | t-0002 |
|
58
|
+
And the broker should have received a "SEND" frame with headers
|
59
|
+
| header-name | header-value |
|
60
|
+
| transaction | t-0002 |
|
61
|
+
And the broker should have received a "NACK" frame with headers
|
62
|
+
| header-name | header-value |
|
63
|
+
| transaction | t-0002 |
|
64
|
+
And the broker should have received a "ABORT" frame with headers
|
65
|
+
| header-name | header-value |
|
66
|
+
| transaction | t-0002 |
|