@Test public void post65SecureShouldUseUniqueIdFromMessage() { long uniqueIdFromMessage = 23456L; when(handshake.getVersion()).thenReturn(Version.GFE_82); serverConnection.setRequestMessage(requestMsg); assertThat(serverConnection.getRequestMessage()).isSameAs(requestMsg); when(requestMsg.isSecureMode()).thenReturn(true); when(messageIdExtractor.getUniqueIdFromMessage(any(Message.class), any(Encryptor.class), anyLong())).thenReturn(uniqueIdFromMessage); serverConnection.setMessageIdExtractor(messageIdExtractor); assertThat(serverConnection.getUniqueId()).isEqualTo(uniqueIdFromMessage); }
static Message readRequest(ServerConnection servConn) { Message requestMsg = null; try { requestMsg = servConn.getRequestMessage(); requestMsg.receive(servConn, MAX_INCOMING_DATA, INCOMING_DATA_LIMITER, INCOMING_MSG_LIMITER); return requestMsg; } catch (EOFException eof) { handleEOFException(null, servConn, eof); // TODO: Check if there is any need for explicitly returning } catch (InterruptedIOException e) { // Solaris only handleInterruptedIOException(servConn, e); } catch (IOException e) { handleIOException(null, servConn, e); } catch (DistributedSystemDisconnectedException e) { handleShutdownException(null, servConn, e); } catch (VirtualMachineError err) { SystemFailure.initiateFailure(err); // If this ever returns, rethrow the error. We're poisoned // now, so don't let this thread continue. throw err; } catch (Throwable e) { SystemFailure.checkFailure(); handleThrowable(null, servConn, e); } return requestMsg; }