events: move EE c'tor guts to EventEmitter.init

After landing 6ed861d it is no longer possible to reliably monkey-patch
the EventEmitter constructor. However there's valid use cases for that,
and makes for easier debugging. Therefore, move the guts of the
constructor to a separate function which is monkey-patchable.

Closes #6693
buffer: optimize writeInt* methods

Remove unnecessary encoding within writeInt*
tls: reintroduce socket.encrypted

Just a property that is always `true` for TLS sockets.

fix #6735
Revert "util: more strict check for bool/number/string"

This reverts commit 95ee84fabe0b028ef964cc1032cd56a6cf89cb0e.
util: introduce CHECK_EQ/CHECK_NE
Merge remote-tracking branch 'upstream/master'