(stream)
| 13 | const tls = require('tls'); |
| 14 | |
| 15 | function connected(stream) { |
| 16 | if (stream) { |
| 17 | // socket connected |
| 18 | stream.write("GET / HTTP/1.0\n\rHost: encrypted.google.com:443\n\r\n\r"); |
| 19 | } else { |
| 20 | console.log("Connection failed!"); |
| 21 | } |
| 22 | } |
| 23 | // needed to keep socket variable in scope |
| 24 | var dummy = this; |
| 25 | // try to connect to the server |