public void endService(SessionType sessionType, byte sessionID) {
   synchronized (PROTOCOL_REFERENCE_LOCK) {
     if (_protocol != null) {
       _protocol.EndProtocolSession(sessionType, sessionID);
     }
   }
 }
  private void closeConnection(boolean willRecycle, byte rpcSessionID) {
    synchronized (PROTOCOL_REFERENCE_LOCK) {
      if (_protocol != null) {
        // If transport is still connected, sent EndProtocolSessionMessage
        if (_transport != null && _transport.getIsConnected()) {
          _protocol.EndProtocolSession(SessionType.RPC, rpcSessionID);
        }
        if (willRecycle) {
          _protocol = null;
        }
      } // end-if
    }

    synchronized (TRANSPORT_REFERENCE_LOCK) {
      if (willRecycle) {
        if (_transport != null) {
          _transport.disconnect();
        }
        _transport = null;
      }
    }
  }