@Override byte[] encode(Response response) throws IOException { return translation.serializeResponse(response); } }
@Override byte[] encode(Response response) throws IOException { try (final Context ctx = serializationTimer.start()) { return translation.serializeResponse(response); } } }
@Override byte[] encode(Response response) throws IOException { try (final Context ctx = serializationTimer.start()) { return translation.serializeResponse(response); } } }
public Response apply(Response response) throws IOException { // Serialize and then re-pare the response return translation.parseResponse(translation.serializeResponse(response)); } }
public Response apply(Response response) throws IOException { // Serialize and then re-pare the response return translation.parseResponse(translation.serializeResponse(response)); } }
public Response apply(Response response) throws IOException { // Serialize and then re-pare the response return translation.parseResponse(translation.serializeResponse(response)); } }
@Override public Response _apply(Request request) { try { // Serialize the request to "send to the server" byte[] serializedRequest = translation.serializeRequest(request); // *some transport would normally happen here* // Fake deserializing that request somewhere else Request request2 = translation.parseRequest(serializedRequest); // Serialize the response from the service to "send to the client" byte[] serializedResponse = translation.serializeResponse(request2.accept(service)); // *some transport would normally happen here* // Deserialize the response on "the client" return translation.parseResponse(serializedResponse); } catch (IOException e) { throw new RuntimeException(e); } } }
@Override public Response _apply(Request request) { try { // Serialize the request to "send to the server" byte[] serializedRequest = translation.serializeRequest(request); // *some transport would normally happen here* // Fake deserializing that request somewhere else Request request2 = translation.parseRequest(serializedRequest); // Serialize the response from the service to "send to the client" byte[] serializedResponse = translation.serializeResponse(request2.accept(service)); // *some transport would normally happen here* // Deserialize the response on "the client" return translation.parseResponse(serializedResponse); } catch (IOException e) { throw new RuntimeException(e); } } }
@Override public Response _apply(Request request) { try { // Serialize the request to "send to the server" byte[] serializedRequest = translation.serializeRequest(request); // *some transport would normally happen here* // Fake deserializing that request somewhere else Request request2 = translation.parseRequest(serializedRequest); // Serialize the response from the service to "send to the client" byte[] serializedResponse = translation.serializeResponse(request2.accept(service)); // *some transport would normally happen here* // Deserialize the response on "the client" return translation.parseResponse(serializedResponse); } catch (IOException e) { throw new RuntimeException(e); } } }
when(translation.serializeResponse(response)) .thenReturn(response.serialize().toByteArray());
when(translation.serializeResponse(response)) .thenReturn(response.serialize().toByteArray());
when(translation.serializeResponse(response)) .thenReturn(response.serialize().toByteArray());