use of com.canoo.dp.impl.platform.client.http.HttpClientImpl in project dolphin-platform by canoo.
the class TestDolphinPlatformHttpClientConnector method testBadResponse.
@Test(expectedExceptions = DolphinRemotingException.class)
public void testBadResponse() throws DolphinRemotingException, URISyntaxException {
PlatformClient.init(new HeadlessToolkit());
PlatformClient.getClientConfiguration().setHttpURLConnectionFactory(new HttpURLConnectionFactory() {
@Override
public HttpURLConnection create(URI url) throws IOException {
return new HttpURLConnection(url.toURL()) {
@Override
public void disconnect() {
}
@Override
public boolean usingProxy() {
return false;
}
@Override
public void connect() throws IOException {
}
@Override
public OutputStream getOutputStream() throws IOException {
return new ByteArrayOutputStream();
}
};
}
});
final ClientModelStore clientModelStore = new ClientModelStore(new DefaultModelSynchronizer(() -> null));
final DolphinPlatformHttpClientConnector connector = new DolphinPlatformHttpClientConnector(getDummyURL(), PlatformClient.getClientConfiguration(), clientModelStore, new JsonCodec(), new SimpleExceptionHandler(), new HttpClientImpl(new Gson(), PlatformClient.getClientConfiguration()));
final List<Command> commands = new ArrayList<>();
commands.add(new CreateContextCommand());
connector.transmit(commands);
}
Aggregations