### Question:
DownloadChain implements Runnable { public synchronized void releaseConnection() { if (connection != null) { connection.release(); Util.d(TAG, "release connection " + connection + " task[" + task.getId() + "] block[" + blockIndex + "]"); } connection = null; } private  DownloadChain(int blockIndex, @NonNull DownloadTask task, @NonNull BreakpointInfo info,
                          @NonNull DownloadCache cache, @NonNull DownloadStore store); long getResponseContentLength(); void setResponseContentLength(long responseContentLength); void cancel(); @NonNull DownloadTask getTask(); @NonNull BreakpointInfo getInfo(); int getBlockIndex(); synchronized void setConnection(@NonNull DownloadConnection connection); @NonNull DownloadCache getCache(); void setRedirectLocation(String location); MultiPointOutputStream getOutputStream(); @Nullable synchronized DownloadConnection getConnection(); @NonNull synchronized DownloadConnection getConnectionOrCreate(); void increaseCallbackBytes(long increaseBytes); void flushNoCallbackIncreaseBytes(); void resetConnectForRetry(); synchronized void releaseConnection(); DownloadConnection.Connected processConnect(); long processFetch(); long loopFetch(); @NonNull DownloadStore getDownloadStore(); @Override void run();  }### Answer:
@Test public void releaseConnection() { final DownloadConnection connection = mock(DownloadConnection.class); chain.setConnection(connection); chain.releaseConnection(); verify(connection).release(); assertThat(chain.getConnection()).isNull(); }