/**
  * @return resource
  * @throws ConnectionException
  */
 public function getSocket()
 {
     if (is_null($this->socket)) {
         throw ConnectionException::NotConnected();
     }
     return $this->socket;
 }