### Question:
AbstractServerStream extends AbstractStream implements ServerStream, MessageFramer.Sink { @Override public final void close(Status status, Metadata trailers) { Preconditions.checkNotNull(status, "status"); Preconditions.checkNotNull(trailers, "trailers"); if (!outboundClosed) { outboundClosed = true; endOfMessages(); addStatusToTrailers(trailers, status); transportState().setClosedStatus(status); abstractServerStreamSink().writeTrailers(trailers, headersSent, status); } } protected  AbstractServerStream(
      WritableBufferAllocator bufferAllocator, StatsTraceContext statsTraceCtx); @Override final void request(int numMessages); @Override final void writeHeaders(Metadata headers); @Override final void deliverFrame(
      WritableBuffer frame, boolean endOfStream, boolean flush, int numMessages); @Override final void close(Status status, Metadata trailers); @Override final void cancel(Status status); @Override final boolean isReady(); @Override final void setDecompressor(Decompressor decompressor); @Override Attributes getAttributes(); @Override String getAuthority(); @Override final void setListener(ServerStreamListener serverStreamListener); @Override StatsTraceContext statsTraceContext();  }### Answer:
@Test public void close_failsOnNullStatus() { thrown.expect(NullPointerException.class); stream.close(null, new Metadata()); }
@Test public void close_failsOnNullMetadata() { thrown.expect(NullPointerException.class); stream.close(Status.INTERNAL, null); }
@Test public void close_sendsTrailers() { Metadata trailers = new Metadata(); stream.close(Status.INTERNAL, trailers); verify(sink).writeTrailers(any(Metadata.class), eq(false), eq(Status.INTERNAL)); }
@Test public void close_sendTrailersClearsReservedFields() { Metadata trailers = new Metadata(); trailers.put(InternalStatus.CODE_KEY, Status.OK); trailers.put(InternalStatus.MESSAGE_KEY, "Everything's super."); Status closeStatus = Status.INTERNAL.withDescription("bad"); stream.close(closeStatus, trailers); verify(sink).writeTrailers(metadataCaptor.capture(), eq(false), eq(closeStatus)); assertEquals( Status.Code.INTERNAL, metadataCaptor.getValue().get(InternalStatus.CODE_KEY).getCode()); assertEquals("bad", metadataCaptor.getValue().get(InternalStatus.MESSAGE_KEY)); }