### Question:
AltsHandshakerClient { public ByteBuffer startServerHandshake(ByteBuffer inBytes) throws GeneralSecurityException { Preconditions.checkState(!isFinished(), "Handshake has already finished."); HandshakerReq.Builder req = HandshakerReq.newBuilder(); setStartServerFields(req, inBytes); HandshakerResp resp; try { resp = handshakerStub.send(req.build()); } catch (IOException | InterruptedException e) { throw new GeneralSecurityException(e); } handleResponse(resp); inBytes.position(inBytes.position() + resp.getBytesConsumed()); return resp.getOutFrames().asReadOnlyByteBuffer(); } AltsHandshakerClient(HandshakerServiceStub stub, AltsHandshakerOptions options); @VisibleForTesting  AltsHandshakerClient(AltsHandshakerStub handshakerStub, AltsHandshakerOptions options); boolean isFinished(); HandshakerStatus getStatus(); HandshakerResult getResult(); byte[] getKey(); ByteBuffer startClientHandshake(); ByteBuffer startServerHandshake(ByteBuffer inBytes); ByteBuffer next(ByteBuffer inBytes); void close();  }### Answer:
@Test public void startServerHandshakeFailure() throws Exception { when(mockStub.send(Matchers.<HandshakerReq>any())) .thenReturn(MockAltsHandshakerResp.getErrorResponse()); try { ByteBuffer inBytes = ByteBuffer.allocate(IN_BYTES_SIZE); handshaker.startServerHandshake(inBytes); fail("Exception expected"); } catch (GeneralSecurityException ex) { assertThat(ex).hasMessageThat().contains(MockAltsHandshakerResp.getTestErrorDetails()); } }