@@ -41,16 +41,6 @@ describe('HttpStreamTransport', () => {
4141 } ) ;
4242 } ) ;
4343
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-
5444 describe ( 'Transport Management' , ( ) => {
5545 it ( 'should start and stop successfully' , async ( ) => {
5646 expect ( transport . isRunning ( ) ) . toBe ( false ) ;
@@ -138,20 +128,7 @@ describe('HttpStreamTransport', () => {
138128 expect ( transport . isRunning ( ) ) . toBe ( false ) ;
139129 } ) ;
140130
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-
149131 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-
155132 // Start and verify state
156133 await transport . start ( ) ;
157134 expect ( transport . isRunning ( ) ) . toBe ( true ) ;
@@ -193,33 +170,32 @@ describe('HttpStreamTransport', () => {
193170 } ) ;
194171 } ) ;
195172
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 ( ) ;
209177 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)
218178
219- expect ( transport ) . toBeDefined ( ) ;
220- expect ( typeof transport . setServerConfig ) . toBe ( 'function' ) ;
179+ // Should have standard transport interface methods
221180 expect ( typeof transport . send ) . toBe ( 'function' ) ;
222181 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 ) ;
223199 } ) ;
224200 } ) ;
225201} ) ;
0 commit comments