ServerConnection implements Runnable { public long getUniqueId() { long uniqueId; if (handshake.getVersion().isOlderThan(KnownVersion.GFE_65) || communicationMode.isWAN()) { uniqueId = userAuthId; } else if (requestMessage.isSecureMode()) { uniqueId = messageIdExtractor.getUniqueIdFromMessage(requestMessage, handshake.getEncryptor(), connectionId); } else { throw new AuthenticationRequiredException("No security credentials are provided"); } return uniqueId; } ServerConnection(final Socket socket, final InternalCache internalCache,
      final CachedRegionHelper cachedRegionHelper, final CacheServerStats stats,
      final int hsTimeout, final int socketBufferSize, final String communicationModeStr,
      final byte communicationMode, final Acceptor acceptor,
      final SecurityService securityService); static ByteBuffer allocateCommBuffer(int size, Socket sock); static void releaseCommBuffer(ByteBuffer bb); static void emptyCommBufferPool(); Acceptor getAcceptor(); static void executeFunctionOnLocalNodeOnly(Byte value); static Byte isExecuteFunctionOnLocalNodeOnly(); InternalCache getCache(); ServerSideHandshake getHandshake(); void setHandshake(ServerSideHandshake handshake); KnownVersion getClientVersion(); @Deprecated InternalLogWriter getSecurityLogWriter(); void setCq(String cqName, boolean isDurable); void removeCq(String cqName, boolean isDurable); boolean isClientServerConnection(); boolean getProcessMessages(); boolean isTerminated(); void removeUserAuth(Message message, boolean keepAlive); byte[] setCredentials(Message message); Part updateAndGetSecurityPart(); boolean isInternalMessage(Message message, boolean allowOldInternalMessages); @Override void run(); static void setForceClientCrashEvent(boolean value); String getMembershipID(); int getSocketPort(); String getSocketHost(); void setRequestSpecificTimeout(int requestSpecificTimeout); String getSocketString(); void incrementLatestBatchIdReplied(int justProcessed); int getLatestBatchIdReplied(); boolean isOpen(); boolean isClosed(); void cleanup(boolean timedOut); boolean cleanup(); void emergencyClose(); @Override String toString(); String getName(); ClientProxyMembershipID getProxyID(); CachedRegionHelper getCachedRegionHelper(); CacheServerStats getCacheServerStats(); Message getReplyMessage(); ChunkedMessage getChunkedResponseMessage(); Message getErrorResponseMessage(); Message getResponseMessage(); ChunkedMessage getFunctionResponseMessage(); ChunkedMessage getRegisterInterestResponseMessage(); void setModificationInfo(boolean potentialModification, String modRegion, Object modKey); void setAsTrue(int boolID); boolean getTransientFlag(int boolID); void setFlagProcessMessagesAsFalse(); @Deprecated InternalLogWriter getLogWriter(); long getUniqueId(); AuthorizeRequest getAuthzRequest(); AuthorizeRequestPP getPostAuthzRequest(); byte[] getEventMemberIDByteArray(); void setClientDisconnectCleanly(); void setClientDisconnectedException(Throwable e); @MutableForTesting
  static boolean allowInternalMessagesWithoutCredentials; }
@Test public void post65NonSecureShouldThrow() { when(handshake.getVersion()).thenReturn(KnownVersion.GFE_82); Throwable thrown = catchThrowable(() -> serverConnection.getUniqueId()); assertThat(thrown) .isExactlyInstanceOf(AuthenticationRequiredException.class) .hasMessage("No security credentials are provided"); }