public function testIsValid()
 {
     $this->assertTrue(SubscribeStartPoint::is_valid(SubscribeStartPoint::START_FROM_FIRST_POINT));
     $this->assertTrue(SubscribeStartPoint::is_valid(SubscribeStartPoint::START_FROM_CURRENT_POINT));
     $normal_position = 65535;
     $this->assertTrue(SubscribeStartPoint::is_valid($normal_position));
     $abnormal_position = -42;
     $this->assertFalse(SubscribeStartPoint::is_valid($abnormal_position));
 }
 /**
  * 内部实现初始化subscriber成员的功能
  * @return true on success or false on failure
  */
 private function _init($pipe_name, $token, $pipelet_id, $start_point, $conf)
 {
     // todo 仔细检查参数
     if (!SubscribeStartPoint::is_valid($start_point)) {
         BigpipeLog::fatal("[%s:%u][%s][invalid start point][val:%d]", __FILE__, __LINE__, __FUNCTION__, $start_point);
         return false;
     } else {
         $this->_start_point = $start_point;
         $this->_pipelet_msg_id = $start_point;
     }
     $this->_pipe_name = $pipe_name;
     $this->_token = $token;
     $this->_pipelet_id = $pipelet_id;
     // 归位操作
     $conf->stomp_conf->conn_conf->check_frame = false;
     $conf->meta_conf->conn_conf->check_frame = false;
     // meta agent不做整包校验
     if (false === $this->_meta_adapter->init($conf->meta_conf)) {
         BigpipeLog::fatal('[%s:%u][%s][fail to init MetaAgentAdapter]', __FILE__, __LINE__, __FUNCTION__);
         return false;
     }
     // 根据checksum leve修改meta和stomp中connection配置
     if (BigpipeChecksumLevel::DISABLE == $conf->checksum_level) {
         $this->_enable_checksum = false;
     } else {
         if (BigpipeChecksumLevel::CHECK_FRAME == $conf->checksum_level || BigpipeChecksumLevel::CHECK_MESSAGE == $conf->checksum_level) {
             $this->_enable_checksum = true;
             if (BigpipeChecksumLevel::CHECK_FRAME == $conf->checksum_level) {
                 $conf->stomp_conf->conn_conf->check_frame = true;
             }
         } else {
             BigpipeLog::fatal('[%s:%u][%s][invalid checksum level][checksum level:%d]', __FILE__, __LINE__, __FUNCTION__, $conf->checksum_level);
             return false;
         }
     }
     $this->_stomp_adapter = new BigpipeStompAdapter($conf->stomp_conf);
     $this->_conn_timeo = $conf->conn_timo;
     $this->_pref_conn = $conf->prefer_conn;
     $this->_max_fo_cnt = $conf->max_failover_cnt;
     $this->_package = new BigpipeMessagePackage();
     // 连接meta agent, 初始化一个meta实例
     if (!$this->_meta_adapter->connect()) {
         BigpipeLog::fatal("[%s:%u][%s][can not connect to meta agent]", __FILE__, __LINE__, __FUNCTION__);
         return false;
     }
     return true;
 }