Mockito.when(conn.getRoute()).thenReturn(route);
Mockito.when(conn.isSecure()).thenReturn(Boolean.FALSE);
Mockito.when(conn.getRemoteAddress()).thenReturn(InetAddress.getByName("localhost"));
Mockito.when(conn.getRemotePort()).thenReturn(1234);
HttpContext context = new BasicHttpContext();
context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
context.setAttribute(ClientContext.COOKIE_STORE, this.cookieStore);
context.setAttribute(ClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);
HttpRequestInterceptor interceptor = new RequestAddCookies();
interceptor.process(request, context);
CookieOrigin cookieOrigin = (CookieOrigin) context.getAttribute(
ClientContext.COOKIE_ORIGIN);
Assert.assertNotNull(cookieOrigin);
Assert.assertEquals(this.target.getHostName(), cookieOrigin.getHost());
Assert.assertEquals(1234, cookieOrigin.getPort());
Assert.assertEquals("/stuff", cookieOrigin.getPath());