@@ -336,6 +336,19 @@ describe('high level API - 1st without stream multiplexing (on TCP)', function (
336
336
} )
337
337
} )
338
338
339
+ it ( 'dial on protocol (returned conn)' , ( done ) => {
340
+ swarmB . handle ( '/apples/1.0.0' , ( conn ) => {
341
+ conn . pipe ( conn )
342
+ } )
343
+
344
+ const conn = swarmA . dial ( peerB , '/apples/1.0.0' , ( err ) => {
345
+ expect ( err ) . to . not . exist
346
+ } )
347
+ conn . end ( )
348
+ conn . on ( 'data' , ( ) => { } ) // let it flow.. let it flooooow
349
+ conn . on ( 'end' , done )
350
+ } )
351
+
339
352
it ( 'dial to warm a conn' , ( done ) => {
340
353
swarmA . dial ( peerB , ( err ) => {
341
354
expect ( err ) . to . not . exist
@@ -618,6 +631,21 @@ describe('high level API - with everything mixed all together!', function () {
618
631
} )
619
632
} )
620
633
634
+ it ( 'dial from tcp to tcp+ws (returned conn)' , ( done ) => {
635
+ swarmB . handle ( '/grapes/1.0.0' , ( conn ) => {
636
+ conn . pipe ( conn )
637
+ } )
638
+
639
+ const conn = swarmA . dial ( peerB , '/grapes/1.0.0' , ( err , conn ) => {
640
+ expect ( err ) . to . not . exist
641
+ expect ( Object . keys ( swarmA . muxedConns ) . length ) . to . equal ( 1 )
642
+ } )
643
+ conn . end ( )
644
+
645
+ conn . on ( 'data' , ( ) => { } ) // let it flow.. let it flooooow
646
+ conn . on ( 'end' , done )
647
+ } )
648
+
621
649
it ( 'dial from tcp+ws to tcp+ws' , ( done ) => {
622
650
swarmC . handle ( '/mamao/1.0.0' , ( conn ) => {
623
651
conn . pipe ( conn )
0 commit comments