TransportAuthenticationProvider<Executor, Executor> authProvider = mock(TransportAuthenticationProvider.class);
when(authProvider.canAuthenticate(Executor.class)).thenReturn(true);
Executor executor = mock(Executor.class);
Response response = mock(Response.class);
HttpResponse httpResponse = mock(HttpResponse.class);
StatusLine statusLine = mock(StatusLine.class);
when(statusLine.getStatusCode()).thenReturn(404);
when(httpResponse.getStatusLine()).thenReturn(statusLine);
when(response.returnResponse()).thenReturn(httpResponse);
when(executor.execute(any(Request.class))).thenReturn(response);
when(authProvider.authenticate(any(Executor.class), any(TransportAuthenticationContext.class))).thenReturn(executor);
ReplicationEndpoint endpoint = new ReplicationEndpoint("http://127.0.0.1:8080/some/resource");