### Question:
TyrusClientEngine implements ClientEngine { @Override public ClientUpgradeInfo processResponse(final UpgradeResponse upgradeResponse, final Writer writer, final Connection.CloseListener closeListener) { if (LOGGER.isLoggable(Level.FINE)) { debugContext.appendLogMessage(LOGGER, Level.FINE, DebugContext.Type.MESSAGE_IN, "Received handshake " + "response: \n" + Utils.stringifyUpgradeResponse(upgradeResponse)); } else { if (logUpgradeMessages) { debugContext.appendStandardOutputMessage(DebugContext.Type.MESSAGE_IN, "Received handshake response: " + "\n" + Utils.stringifyUpgradeResponse(upgradeResponse)); } } if (clientEngineState == TyrusClientEngineState.AUTH_UPGRADE_REQUEST_CREATED || clientEngineState == TyrusClientEngineState.UPGRADE_REQUEST_CREATED) { if (upgradeResponse == null) { throw new IllegalArgumentException(LocalizationMessages.ARGUMENT_NOT_NULL("upgradeResponse")); } switch (upgradeResponse.getStatus()) { case 101: return handleSwitchProtocol(upgradeResponse, writer, closeListener); case 300: case 301: case 302: case 303: case 307: case 308: return handleRedirect(upgradeResponse); case 401: return handleAuth(upgradeResponse); case 503: String retryAfterString = null; final List<String> retryAfterHeader = upgradeResponse.getHeaders() .get(UpgradeResponse.RETRY_AFTER); if (retryAfterHeader != null) { retryAfterString = Utils.getHeaderFromList(retryAfterHeader); } Long delay; if (retryAfterString != null) { try { Date date = Utils.parseHttpDate(retryAfterString); delay = (date.getTime() - System.currentTimeMillis()) / 1000; } catch (ParseException e) { try { delay = Long.parseLong(retryAfterString); } catch (NumberFormatException iae) { delay = null; } } } else { delay = null; } listener.onError(new RetryAfterException( LocalizationMessages.HANDSHAKE_HTTP_RETRY_AFTER_MESSAGE(), delay)); return UPGRADE_INFO_FAILED; default: clientEngineState = TyrusClientEngineState.FAILED; HandshakeException e = new HandshakeException( upgradeResponse.getStatus(), LocalizationMessages.INVALID_RESPONSE_CODE(101, upgradeResponse.getStatus())); listener.onError(e); redirectUriHistory.clear(); return UPGRADE_INFO_FAILED; } } redirectUriHistory.clear(); throw new IllegalStateException(); } TyrusClientEngine(TyrusEndpointWrapper endpointWrapper, ClientHandshakeListener listener,
                                    Map<String, Object> properties, URI connectToServerUriParam,
                                    DebugContext debugContext); @Override UpgradeRequest createUpgradeRequest(TimeoutHandler timeoutHandler); @Override ClientUpgradeInfo processResponse(final UpgradeResponse upgradeResponse,
                                             final Writer writer, final Connection.CloseListener closeListener); @Override void processError(Throwable t); TimeoutHandler getTimeoutHandler(); static final int DEFAULT_INCOMING_BUFFER_SIZE; }### Answer:
@Test public void testCallProcessResponseFirst() throws DeploymentException { ClientEngine engine = getClientEngine(Collections.<String, Object>emptyMap()); try { engine.processResponse(getUpgradeResponse(""), null, null); fail("Second call of createUpgradeRequest must fail"); } catch (IllegalStateException e) { } }