@@ -41,16 +41,6 @@ describe('HttpStreamTransport', () => {
41
41
} ) ;
42
42
} ) ;
43
43
44
- describe ( 'Server Configuration' , ( ) => {
45
- it ( 'should set server configuration and setup callback' , ( ) => {
46
- const serverConfig = { name : 'test-server' , version : '1.0.0' } ;
47
- const setupCallback = async ( ) => { } ;
48
-
49
- // Should not throw when setting configuration
50
- expect ( ( ) => transport . setServerConfig ( serverConfig , setupCallback ) ) . not . toThrow ( ) ;
51
- } ) ;
52
- } ) ;
53
-
54
44
describe ( 'Transport Management' , ( ) => {
55
45
it ( 'should start and stop successfully' , async ( ) => {
56
46
expect ( transport . isRunning ( ) ) . toBe ( false ) ;
@@ -138,20 +128,7 @@ describe('HttpStreamTransport', () => {
138
128
expect ( transport . isRunning ( ) ) . toBe ( false ) ;
139
129
} ) ;
140
130
141
- it ( 'should support proper session management structure' , ( ) => {
142
- const serverConfig = { name : 'multi-client-server' , version : '1.0.0' } ;
143
- const setupCallback = async ( ) => { } ;
144
-
145
- // Should accept configuration for multi-client support
146
- expect ( ( ) => transport . setServerConfig ( serverConfig , setupCallback ) ) . not . toThrow ( ) ;
147
- } ) ;
148
-
149
131
it ( 'should handle server lifecycle correctly' , async ( ) => {
150
- // Set up server configuration first
151
- const serverConfig = { name : 'test-server' , version : '1.0.0' } ;
152
- const setupCallback = async ( ) => { } ;
153
- transport . setServerConfig ( serverConfig , setupCallback ) ;
154
-
155
132
// Start and verify state
156
133
await transport . start ( ) ;
157
134
expect ( transport . isRunning ( ) ) . toBe ( true ) ;
@@ -193,33 +170,32 @@ describe('HttpStreamTransport', () => {
193
170
} ) ;
194
171
} ) ;
195
172
196
- describe ( 'Integration with Framework Pattern' , ( ) => {
197
- it ( 'should follow the multi-session architecture' , ( ) => {
198
- const serverConfig = {
199
- name : 'http-stream-server' ,
200
- version : '1.0.0' ,
201
- } ;
202
-
203
- const setupCallback = async ( ) => { } ;
204
-
205
- // Should accept the configuration pattern used by working examples
206
- expect ( ( ) => transport . setServerConfig ( serverConfig , setupCallback ) ) . not . toThrow ( ) ;
207
-
208
- // Should maintain the http-stream transport type
173
+ describe ( 'Unified Transport Architecture' , ( ) => {
174
+ it ( 'should use standard MCP protocol flow like other transports' , ( ) => {
175
+ // HTTP transport now uses the same unified architecture as SSE and stdio
176
+ expect ( transport ) . toBeDefined ( ) ;
209
177
expect ( transport . type ) . toBe ( 'http-stream' ) ;
210
- } ) ;
211
-
212
- it ( 'should support the official MCP pattern for session management' , ( ) => {
213
- // Verify the transport supports the pattern:
214
- // 1. Each session gets its own transport instance (handled by our implementation)
215
- // 2. Each session gets its own McpServer instance (handled by setServerConfig)
216
- // 3. Server connects to transport (handled by our implementation)
217
- // 4. Transport stores sessions in a map (our _transports map)
218
178
219
- expect ( transport ) . toBeDefined ( ) ;
220
- expect ( typeof transport . setServerConfig ) . toBe ( 'function' ) ;
179
+ // Should have standard transport interface methods
221
180
expect ( typeof transport . send ) . toBe ( 'function' ) ;
222
181
expect ( typeof transport . close ) . toBe ( 'function' ) ;
182
+ expect ( typeof transport . start ) . toBe ( 'function' ) ;
183
+ expect ( typeof transport . isRunning ) . toBe ( 'function' ) ;
184
+ } ) ;
185
+
186
+ it ( 'should support message handling through onmessage handler' , ( ) => {
187
+ // HTTP transport now uses standard onmessage handler like other transports
188
+ let messageReceived : JSONRPCMessage | undefined ;
189
+
190
+ // Setting onmessage should not throw
191
+ expect ( ( ) => {
192
+ transport . onmessage = async ( message : JSONRPCMessage ) => {
193
+ messageReceived = message ;
194
+ } ;
195
+ } ) . not . toThrow ( ) ;
196
+
197
+ // Verify the transport has the onmessage property in its interface
198
+ expect ( 'onmessage' in transport ) . toBe ( true ) ;
223
199
} ) ;
224
200
} ) ;
225
201
} ) ;
0 commit comments