public HandshakerResp send ( HandshakerReq req ) throws InterruptedException , IOException { maybeThrowIoException ( ) ; if ( ! responseQueue . isEmpty ( ) ) { throw new IOException ( "Received an unexpected response." ) ; } writer . onNext ( req ) ; Optional < HandshakerResp > result = responseQueue . take ( ) ; if ( ! result . isPresent ( ) ) { maybeThrowIoException ( ) ; } return result . get ( ) ; }
Send a handshaker request and return the handshaker response .