我有一个Jersey客户端,当我不使用代理时,它可以正常工作。但是,当我添加代理配置时,由于以下ssl对等端关闭错误而失败。
代码段如下
try{
final Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
client.property("http.proxyHost",proxyHost);
client.property("http.proxyPort",proxyPort);
final StreamDataBodyPart stream = new StreamDataBodyPart("file", inputStream);
FormDataMultiPart formDataMultiPart = new FormDataMultiPart();
final MultiPart multiPart = formDataMultiPart.field("fileName", "sample").bodyPart(stream);
if (multiPart instanceof FormDataMultiPart) {
final FormDataMultiPart dataMultiPart = (FormDataMultiPart) multiPart;
final WebTarget target = client.target("url");
return target.request().header("test", "test")
.post(Entity.entity(dataMultiPart, dataMultiPart.getMediaType()));
}
return null;
} catch (Exception ex) {
log.error("Error Uploading Image", ex);
}
有人可以指出问题吗?