 		public function handleChannelClose():void {
 			_logger.debug("Channel closed (alive: {})", _alive);
 
+
+			_messaging = false;
 			_alive = false;
 			_channel = null;
 			if (_opened) {


		public function acceptChannel(channel:Channel):ChannelHandler {
			if (_opened) {
				_alive = true;
				_logger.debug("Channel opened");

				_channel = channel;
				_processor.processAccept();
				return this;

					}
					else {
						_outputMessages.removeFirst();
						sendNextMessageIfExists();
					}
				}
			}
		}

		private function beginSessionDelayed():void {
			_messaging = true;
			_client.processConnected();
			if (_messaging && _outputMessageSendAvailable) {
				sendNextMessageIfExists();
			}
		}

		private function recoverSessionDelayed():void {
			_messaging = true;
			_client.processConnectionEstablished();
		}

		private function sendNextMessageIfExists():void {
			if (!_outputMessages.isEmpty()) {
				sendMessage0(ByteArray(_outputMessages.getFirst()));
			}
		}

		private function sendNextMessage():void {
			sendMessage0(ByteArray(_outputMessages.getFirst()));
		}

		private function sendMessage0(message:ByteArray):void {
			if (!_outputMessageSendAvailable) {
				throw new IllegalStateException("Send message is not available");
			}
			if (message.length == 0) {
				throw new IllegalArgumentException("Outgoing message is empty");
			}
