@Override 
	public void run () {
		Selector selector			= null;
		SocketChannel socketChannel	= null;
		try {
			selector = Selector.open();
			
			socketChannel = SocketChannel.open();
			socketChannel.configureBlocking(false);
			socketChannel.connect(new InetSocketAddress(this.ip, this.port));
			
			ByteBuffer buf = ByteBuffer.allocateDirect(BUF_SIZE);
			
			ByteArrayOutputStream bos = new ByteArrayOutputStream();
			ObjectOutput out = null;
			byte[] data;
			
			try {
				  out = new ObjectOutputStream(bos);   
				  out.writeObject(this.msg);
				  data = bos.toByteArray();
			} finally {
				out.close();
				bos.close();
			}
			
			buf.put(data);
			buf.flip();
			
			
			socketChannel.register(selector, SelectionKey.OP_CONNECT, buf);
			
			
			while (running) {
				selector.select();
				
				for (Iterator<SelectionKey> it = selector.selectedKeys().iterator(); it.hasNext(); ) {
					SelectionKey key = it.next();
					it.remove();
					
					if (key.isConnectable())
						connect(key);
					else if (key.isWritable())
						write(key);
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (selector != null)
				try {
					selector.close();
				} catch (IOException e) {}
			
			if (socketChannel != null)
				try {
					socketChannel.close();
				} catch (IOException e) {}
		}
	}