### Question:
AbstractClientStream extends AbstractStream implements ClientStream, MessageFramer.Sink { @Override public final void start(ClientStreamListener listener) { transportState().setListener(listener); if (!useGet) { abstractClientStreamSink().writeHeaders(headers, null); headers = null; } } protected  AbstractClientStream(
      WritableBufferAllocator bufferAllocator,
      StatsTraceContext statsTraceCtx,
      TransportTracer transportTracer,
      Metadata headers,
      CallOptions callOptions,
      boolean useGet); @Override void setDeadline(Deadline deadline); @Override void setMaxOutboundMessageSize(int maxSize); @Override void setMaxInboundMessageSize(int maxSize); @Override final void setFullStreamDecompression(boolean fullStreamDecompression); @Override final void setDecompressorRegistry(DecompressorRegistry decompressorRegistry); @Override final void start(ClientStreamListener listener); final boolean shouldBeCountedForInUse(); @Override final void request(int numMessages); @Override final void deliverFrame(
      WritableBuffer frame, boolean endOfStream, boolean flush, int numMessages); @Override final void halfClose(); @Override final void cancel(Status reason); @Override final boolean isReady();  }### Answer:
@Test public void startFailsOnNullListener() { AbstractClientStream stream = new BaseAbstractClientStream(allocator, statsTraceCtx, transportTracer); thrown.expect(NullPointerException.class); stream.start(null); }
@Test public void cantCallStartTwice() { AbstractClientStream stream = new BaseAbstractClientStream(allocator, statsTraceCtx, transportTracer); stream.start(mockListener); thrown.expect(IllegalStateException.class); stream.start(mockListener); }
@Test public void writeMessage_closesStream() throws IOException { AbstractClientStream.Sink sink = mock(AbstractClientStream.Sink.class); final TestClientStreamTracer tracer = new TestClientStreamTracer(); StatsTraceContext statsTraceCtx = new StatsTraceContext(new StreamTracer[] {tracer}); AbstractClientStream stream = new BaseAbstractClientStream( allocator, new BaseTransportState(statsTraceCtx, transportTracer), sink, statsTraceCtx, transportTracer, true); stream.start(mockListener); InputStream input = mock(InputStream.class, delegatesTo(new ByteArrayInputStream(new byte[1]))); stream.writeMessage(input); verify(input).close(); }