DelayedStream implements ClientStream { @Override public void start(final ClientStreamListener listener) { checkState(this.listener == null, "already started"); Status savedError; synchronized (this) { this.listener = checkNotNull(listener, "listener"); savedError = error; } if (savedError != null) { listener.closed(savedError, new Metadata()); return; } delayOrExecute(new Runnable() { @Override public void run() { realStream.start(listener); } }); }  @Override void setAuthority(final String authority); @Override void start(final ClientStreamListener listener); @Override void writeMessage(final InputStream message); @Override void flush(); @Override void cancel(final Status reason); @Override void halfClose(); @Override void request(final int numMessages); @Override void setCompressor(final Compressor compressor); @Override void setDecompressor(Decompressor decompressor); @Override boolean isReady(); @Override void setMessageCompression(final boolean enable);  }
@Test(expected = IllegalStateException.class) public void start_afterStart() { stream.start(listener); stream.start(mock(ClientStreamListener.class)); }