@ObjectiveCName("init:options:client:endpoint:") Connection(final String url,final DeepstreamConfig options,DeepstreamClient client,Endpoint endpoint){
  this.client=client;
  this.connectStateListeners=new ArrayList<>();
  this.originalUrl=url;
  this.url=url;
  this.connectionState=ConnectionState.CLOSED;
  this.messageBuffer=new StringBuilder();
  this.tooManyAuthAttempts=false;
  this.challengeDenied=false;
  this.deliberateClose=false;
  this.redirecting=false;
  this.reconnectTimeout=null;
  this.reconnectionAttempt=0;
  this.options=options;
  this.endpoint=endpoint;
  this.recordThread=Executors.newSingleThreadExecutor();
  this.eventThread=Executors.newSingleThreadExecutor();
  this.rpcThread=Executors.newSingleThreadExecutor();
}

@ ObjectiveCName ( "init:options:client:endpoint:" ) Connection ( final String url , final DeepstreamConfig options , DeepstreamClient client , Endpoint endpoint ) { this . client = client ; this . connectStateListeners = new ArrayList < > ( ) ; this . originalUrl = url ; this . url = url ; this . connectionState = ConnectionState . CLOSED ; this . messageBuffer = new StringBuilder ( ) ; this . tooManyAuthAttempts = false ; this . challengeDenied = false ; this . deliberateClose = false ; this . redirecting = false ; this . reconnectTimeout = null ; this . reconnectionAttempt = 0 ; this . options = options ; this . endpoint = endpoint ; this . recordThread = Executors . newSingleThreadExecutor ( ) ; this . eventThread = Executors . newSingleThreadExecutor ( ) ; this . rpcThread = Executors . newSingleThreadExecutor ( ) ; }
creates a connection , that is responsible for handling all the connection related logic related to state and messages
