 		
 		public function XMPPConnection()
 		{	
-			// Create the socket
-			socket = new XMLSocket();
-			socket.addEventListener(Event.CONNECT,socketConnected);
-			socket.addEventListener(IOErrorEvent.IO_ERROR,onIOError);
-			socket.addEventListener(Event.CLOSE,socketClosed);
-			socket.addEventListener(DataEvent.DATA,socketReceivedData);
-			socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR,securityError);
 			
 			// Hash to hold callbacks for IQs
 			pendingIQs = new Object();

				if( pendingIQs[iq.id] !== undefined ) {
					var callbackInfo:* = pendingIQs[iq.id];
					
					callbackInfo.methodScope[callbackInfo.methodName].apply( callbackInfo.methodScope, [iq] );			
					if (callbackInfo.func != null) { 
						callbackInfo.func( iq );
					}

					closingStreamTag = new String( "</stream:stream>" );
					break;
			}
			_socket.connect( server, port );
			return true;
		}
		
