@Override
    public SmileResponse<T> handle(Request request, Response response)
    {
        byte[] bytes = readResponseBytes(response);
        String contentType = response.getHeader(CONTENT_TYPE);
        if ((contentType == null) || !MediaType.parse(contentType).is(MEDIA_TYPE_SMILE)) {
            return new SmileResponse<>(response.getStatusCode(), response.getHeaders(), bytes);
        }
        return new SmileResponse<>(response.getStatusCode(), response.getHeaders(), smileCodec, bytes);
    }
@Test
    public void testInvalidSmile()
    {
        byte[] invalidSmileBytes = "test".getBytes(UTF_8);
        SmileResponse<User> response = handler.handle(null, mockResponse(OK, MEDIA_TYPE_SMILE, invalidSmileBytes));

        assertFalse(response.hasValue());
        assertEquals(response.getException().getMessage(), format("Unable to create %s from SMILE response", User.class));
        assertTrue(response.getException().getCause() instanceof IllegalArgumentException);
        assertEquals(response.getException().getCause().getMessage(), "Invalid SMILE bytes for [simple type, class com.facebook.presto.server.smile.TestFullSmileResponseHandler$User]");

        assertEquals(response.getSmileBytes(), invalidSmileBytes);
        assertEquals(response.getResponseBytes(), response.getSmileBytes());
    }