Port the Extensions class from websocket-extensions-node.