File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ var assert = require ( 'assert' ) ;
2
+ var common = require ( '../../common' ) ;
3
+ var connection = common . createConnection ( {
4
+ port : common . fakeServerPort ,
5
+ password : 'authswitch'
6
+ } ) ;
7
+
8
+ var server = common . createFakeServer ( ) ;
9
+
10
+ var connected ;
11
+ server . listen ( common . fakeServerPort , function ( err ) {
12
+ assert . ifError ( err ) ;
13
+
14
+ connection . connect ( function ( err , result ) {
15
+ assert . ifError ( err ) ;
16
+
17
+ connected = result ;
18
+
19
+ connection . destroy ( ) ;
20
+ server . destroy ( ) ;
21
+ } ) ;
22
+ } ) ;
23
+
24
+ server . on ( 'connection' , function ( incomingConnection ) {
25
+ incomingConnection . on ( 'authSwitchResponse' , function ( packet ) {
26
+ this . _sendAuthResponse ( packet . data , Buffer . from ( 'authswitch' ) ) ;
27
+ } ) ;
28
+
29
+ incomingConnection . on ( 'clientAuthentication' , function ( ) {
30
+ this . authSwitchRequest ( {
31
+ authMethodName : 'mysql_clear_password' ,
32
+ authMethodData : Buffer . alloc ( 0 )
33
+ } ) ;
34
+ } ) ;
35
+
36
+ incomingConnection . handshake ( ) ;
37
+ } ) ;
38
+
39
+ process . on ( 'exit' , function ( ) {
40
+ assert . equal ( connected . fieldCount , 0 ) ;
41
+ } ) ;
You can’t perform that action at this time.
0 commit comments