public TransferSinkThread(
     AbstractDataChannel dataChannel,
     SocketBox socketBox,
     DataSink sink,
     BasicServerControlChannel localControlChannel,
     TransferContext context)
     throws Exception {
   this.socketBox = socketBox;
   this.sink = sink;
   this.localControlChannel = localControlChannel;
   this.context = context;
   this.reader = dataChannel.getDataChannelSource(context);
   reader.setDataStream(socketBox.getSocket().getInputStream());
 }
  protected void shutdown(Object quitToken) throws IOException {
    logger.debug("shutdown");

    reader.close();

    // garbage collect the socket
    socketBox.setSocket(null);

    // data sink is shared by all data channels,
    // so should be closed by the last one exiting
    if (quitToken != null) {
      sink.close();
    }
  }