Skip to content

Commit

Permalink
Remove unused code, use variable for so timeout and set charset in We…
Browse files Browse the repository at this point in the history
…bhookSink

Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Oct 18, 2022
1 parent adb1100 commit 7b0e3cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,6 @@ public void setRequestConfig(RequestConfig requestConfig) {
this.requestConfig = requestConfig;
}

// TODO Can this be removed?
// public void setLocalAddress(InetAddress inetAddress) {
// if (requestConfig == null) {
// requestConfig = RequestConfig.custom().setLocalAddress(inetAddress).build();
// } else {
// requestConfig = RequestConfig.copy(requestConfig).setLocalAddress(inetAddress).build();
// }
// }

public boolean isSendHTTPClientCertificate() {
return sendHTTPClientCertificate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,6 @@ public HostnameVerifier getHostnameVerifier() {
return hostnameVerifier;
}

// TODO Can this be removed?
// public SSLIOSessionStrategy toSSLIOSessionStrategy() {
// return new SSLIOSessionStrategy(sslContext, supportedProtocols, supportedCipherSuites, hostnameVerifier);
// }

public SSLConnectionSocketFactory toSSLConnectionSocketFactory() {
return new SSLConnectionSocketFactory(sslContext, supportedProtocols, supportedCipherSuites,
hostnameVerifier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.security.AccessController;
import java.security.KeyStore;
Expand Down Expand Up @@ -275,7 +276,7 @@ protected boolean doPost(String url, String payload) {

HttpPost postRequest = new HttpPost(url);

StringEntity input = new StringEntity(payload, webhookFormat.contentType);
StringEntity input = new StringEntity(payload, webhookFormat.contentType.withCharset(StandardCharsets.UTF_8));
postRequest.setEntity(input);

CloseableHttpResponse serverResponse = null;
Expand Down Expand Up @@ -364,7 +365,7 @@ public boolean isTrusted(X509Certificate[] chain, String authType) {

final HttpClientConnectionManager cm = PoolingHttpClientConnectionManagerBuilder.create()
.setSSLSocketFactory(sslsf)
.setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(60, TimeUnit.SECONDS).build())
.setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(timeout, TimeUnit.SECONDS).build())
.build();
hcb.setConnectionManager(cm);
return hcb.build();
Expand All @@ -381,7 +382,7 @@ public boolean isTrusted(X509Certificate[] chain, String authType) {

final HttpClientConnectionManager cm = PoolingHttpClientConnectionManagerBuilder.create()
.setSSLSocketFactory(sslsf)
.setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(60, TimeUnit.SECONDS).build())
.setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(timeout, TimeUnit.SECONDS).build())
.build();
hcb.setConnectionManager(cm);

Expand Down

0 comments on commit 7b0e3cd

Please sign in to comment.