 			headers.push('Connection: Upgrade');
 			headers.push('Host: ' + _hostport);
 			headers.push('Origin: ' + _origin);
-			if (_cookie) {
+			if (_cookie.length) {
 				headers.push('Cookie: ' + _cookie);
 			}
-			if (_protocols) {
+			if (_protocols.length) {
 				headers.push('Sec-WebSocket-Protocol: ' + _protocols.join(", "));
 			}
 			headers.push('Sec-WebSocket-Key: ' + key);

	[Event(name = "close", type = "org.flashsocket.websocket.events.CloseEvent")]
	[Event(name = "message", type = "org.flashsocket.websocket.events.MessageEvent")]
	[Event(name = "exception", type = "org.flashsocket.websocket.events.ExceptionEvent")]
	
	public class WebSocketClientHandler extends EventDispatcher {
		public static const WEBSOCKET_VERSION:String = "13";

		private var _expectedChallengeResponse:String;
		private var _fragment:WebSocketFrame;
		private var _emptyBufferTimeout:int;
		private var _openingHandshakeTimeout:int;
		private var _closingHandshakeTimeout:int;
		
		private var _secure:Boolean;
