Change the $mask value.
All messages from the client must be masked.
New exception: CloseError.

When thrown from the a protocol implementation, will close the
socket connection in the server or the client with the right code.
Ensure that the mask is well-formed.
Mask all the sent messages.
Use OpenSSL for strong random bytes if available.

Quoting the RFC:

    > The masking key is a 32-bit value chosen at random by the client.
    > When preparing a masked frame, the client MUST pick a fresh
    > masking key from the set of allowed 32-bit values. The masking
    > key needs to be unpredictable; thus, the masking key MUST be
    > derived from a strong source of entropy, and the masking key for a
    > given frame MUST NOT make it simple for a server/proxy to predict
    > the masking key for a subsequent frame. The unpredictability of
    > the masking key is essential to prevent authors of malicious
    > applications from selecting the bytes that appear on the wire.
    > RFC4086 discusses what entails a suitable source of entropy for
    > security-sensitive applications.
Also mask the closing frame.
Renumbering exceptions.
Client properly closes the connection.
Merge branch 'mask_close' into incoming
Respect Section 7.1.1 of the RFC6455.

Quoting the RFC, 7.1.1 Close the WebSocket Connection:

   > To _Close the WebSocket Connection_, an endpoint closes the
   > underlying TCP connection. An endpoint SHOULD use a method that
   > cleanly closes the TCP connection, as well as the TLS session, if
   > applicable, discarding any trailing bytes that may have been
   > received. An endpoint MAY close the connection via any means
   > available when necessary, such as when under attack.
   >
   > The underlying TCP connection, in most normal cases, SHOULD be
   > closed first by the server, so that it holds the TIME_WAIT state
   > and not the client (as this would prevent it from re-opening the
   > connection for 2 maximum segment lifetimes (2MSL), while there is
   > no corresponding server impact as a TIME_WAIT connection is
   > immediately reopened upon a new SYN with a higher seq number). In
   > abnormal cases (such as not having received a TCP Close from the
   > server after a reasonable amount of time) a client MAY initiate the
   > TCP Close. As such, when a server is instructed to _Close the
   > WebSocket Connection_ it SHOULD initiate a TCP Close immediately,
   > and when a client is instructed to do the same, it SHOULD wait for
   > a TCP Close from the server.

Consequently, now, the client starts the disconnection, mute the socket,
wait for a reply from the server and then disconnect the socket. We have
a timeout defined by 2 * MSL. We have choosen the MSL value of FreeBSD.
Since some server (such as tomcat) emit a log when connection are not
properly closed, this PR will avoid useless logs
Reduce memory usage when masking messages.

Avoid to copy the whole message two times in memory. It saves memory
(not able to measure) and also saves CPU (approximately 3 to 5%).
Fix a bug introduced by the previous commit.
Set stream (socket) blocking mode.