private void connectToServer(final ChannelHandler sendRequest) throws Exception {
	  // 这个代码是从Netty官网抄来的，暂时还不知道为什么要这么做！
	  ChannelFactory factory = new NioClientSocketChannelFactory(
	       Executors.newCachedThreadPool(),
	       Executors.newCachedThreadPool());
	  ClientBootstrap bootstrap = new ClientBootstrap(factory);
	  bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
		    public ChannelPipeline getPipeline() 
			 throws Exception {
			 return Channels.pipeline(
			      // 使用自定义的bson格式序列化
			      new ObjectBsonEncoder(),
			      new ObjectBsonDecoder(
				   ClassResolvers.cacheDisabled(
					getClass().getClassLoader())),
			      sendRequest);
		    }
	       });
	  // 下面的设置貌似是TCP长连接，不过我们的计划是将其更新成UDP
	  // 因此也直接抄Netty官网的示例程序好了！
	  bootstrap.setOption("tcpNoDelay", true);
	  bootstrap.setOption("keepAlive", true);
	  
	  // 连接到服务器
	  bootstrap.connect(new InetSocketAddress(TP_SERVER_ADDRESS,
						  TP_SERVER_PORT));	      
     }