@Test public void extractPeerObjectFailure() throws Exception { when(mockClient.isFinished()).thenReturn(false); try { handshakerClient.extractPeerObject(); fail("Expected IllegalStateException"); } catch (IllegalStateException expected) { assertEquals("Handshake is not complete.", expected.getMessage()); } }
@Override public Object extractPeerObject() throws GeneralSecurityException { Preconditions.checkState(!isInProgress(), "Handshake is not complete."); return new AltsAuthContext(handshaker.getResult()); }
AltsTsiHandshaker implements TsiHandshaker { @Override public Object extractPeerObject() throws GeneralSecurityException { Preconditions.checkState(!isInProgress(), "Handshake is not complete."); return new AltsAuthContext(handshaker.getResult()); } }
AltsTsiHandshaker implements TsiHandshaker { @Override public Object extractPeerObject() throws GeneralSecurityException { Preconditions.checkState(!isInProgress(), "Handshake is not complete."); return new AltsAuthContext(handshaker.getResult()); } private  AltsTsiHandshaker(
      boolean isClient, HandshakerServiceStub stub, AltsHandshakerOptions options); @VisibleForTesting  AltsTsiHandshaker(boolean isClient, AltsHandshakerClient handshaker); }
AltsTsiHandshaker implements TsiHandshaker { @Override public Object extractPeerObject() throws GeneralSecurityException { Preconditions.checkState(!isInProgress(), "Handshake is not complete."); return new AltsAuthContext(handshaker.getResult()); } private  AltsTsiHandshaker(
      boolean isClient, HandshakerServiceStub stub, AltsHandshakerOptions options); @VisibleForTesting  AltsTsiHandshaker(boolean isClient, AltsHandshakerClient handshaker); @Override boolean processBytesFromPeer(ByteBuffer bytes); @Override TsiPeer extractPeer(); @Override Object extractPeerObject(); static TsiHandshaker newClient(HandshakerServiceStub stub, AltsHandshakerOptions options); static TsiHandshaker newServer(HandshakerServiceStub stub, AltsHandshakerOptions options); @Override void getBytesToSendToPeer(ByteBuffer bytes); @Override boolean isInProgress(); @Override TsiFrameProtector createFrameProtector(int maxFrameSize, ByteBufAllocator alloc); @Override TsiFrameProtector createFrameProtector(ByteBufAllocator alloc); }
AltsTsiHandshaker implements TsiHandshaker { @Override public Object extractPeerObject() throws GeneralSecurityException { Preconditions.checkState(!isInProgress(), "Handshake is not complete."); return new AltsAuthContext(handshaker.getResult()); } private  AltsTsiHandshaker(
      boolean isClient, HandshakerServiceStub stub, AltsHandshakerOptions options); @VisibleForTesting  AltsTsiHandshaker(boolean isClient, AltsHandshakerClient handshaker); @Override boolean processBytesFromPeer(ByteBuffer bytes); @Override TsiPeer extractPeer(); @Override Object extractPeerObject(); static TsiHandshaker newClient(HandshakerServiceStub stub, AltsHandshakerOptions options); static TsiHandshaker newServer(HandshakerServiceStub stub, AltsHandshakerOptions options); @Override void getBytesToSendToPeer(ByteBuffer bytes); @Override boolean isInProgress(); @Override TsiFrameProtector createFrameProtector(int maxFrameSize, ByteBufAllocator alloc); @Override TsiFrameProtector createFrameProtector(ByteBufAllocator alloc); static final String TSI_SERVICE_ACCOUNT_PEER_PROPERTY; }