Handshake { static void throwIfMissingRequiredCredentials(boolean requireAuthentication, boolean hasCredentials) { if (requireAuthentication && !hasCredentials) { throw new AuthenticationRequiredException( "No security credentials are provided"); } } protected  Handshake(); protected  Handshake(Handshake handshake); static byte[] extractOverrides(byte[] values); void writeCredentials(DataOutputStream dos, DataInputStream dis, Properties p_credentials,
      boolean isNotification, DistributedMember member); void writeCredentials(DataOutputStream dos, DataInputStream dis, Properties p_credentials,
      boolean isNotification, DistributedMember member, HeapDataOutputStream heapdos); boolean isOK(); void setClientReadTimeout(int clientReadTimeout); int getClientReadTimeout(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); ClientProxyMembershipID getMembershipId(); static Properties getCredentials(String authInitMethod, Properties securityProperties,
      DistributedMember server, boolean isPeer, LogWriter logWriter,
      LogWriter securityLogWriter); static Properties readCredentials(DataInputStream dis, DataOutputStream dos,
      DistributedSystem system, SecurityService securityService); static Object verifyCredentials(String authenticatorMethod, Properties credentials,
      Properties securityProperties, InternalLogWriter logWriter,
      InternalLogWriter securityLogWriter, DistributedMember member,
      SecurityService securityService); Object verifyCredentials(); static final byte REPLY_SERVER_IS_LOCATOR; static final byte CREDENTIALS_NONE; static final byte CREDENTIALS_NORMAL; static final byte CREDENTIALS_DHENCRYPT; static final byte SECURITY_MULTIUSER_NOTIFICATIONCHANNEL; static final String PUBLIC_KEY_FILE_PROP; static final String PUBLIC_KEY_PASSWD_PROP; static final String PRIVATE_KEY_FILE_PROP; static final String PRIVATE_KEY_ALIAS_PROP; static final String PRIVATE_KEY_PASSWD_PROP; static final byte CONFLATION_DEFAULT; static final byte CONFLATION_ON; static final byte CONFLATION_OFF; static final byte clientConflationForTesting; static final boolean setClientConflationForTesting; }
@Test public void authRequiredHasCredentials() throws Exception { Handshake.throwIfMissingRequiredCredentials(true, true); }
@Test public void authRequiredHasNoCredentials() throws Exception { assertThatThrownBy(() -> Handshake.throwIfMissingRequiredCredentials(true, false)) .isExactlyInstanceOf(AuthenticationRequiredException.class) .hasMessage("No security credentials are provided"); }
@Test public void authNotRequiredHasCredentials() throws Exception { Handshake.throwIfMissingRequiredCredentials(false, true); }
@Test public void authNotRequiredHasNoCredentials() throws Exception { Handshake.throwIfMissingRequiredCredentials(false, false); }