Skip to content

Commit fc74dfc

Browse files
authored
Add FAQ about SSLSocketFactory
See #14 (comment)
1 parent 587713b commit fc74dfc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,24 @@ compile 'io.tus.java.client:tus-java-client:0.4.1'
100100

101101
The documentation of the latest version (master branch of git repository) can be found online at [tus.github.io/tus-java-client/javadoc/](https://tus.github.io/tus-java-client/javadoc/).
102102

103+
## FAQ
104+
105+
### Can I use my own custom SSLSocketFactory?
106+
107+
Yes, you can! Create a subclass of `TusClient` and override the `prepareConnection` method to attach your `SSLSocketFactory`. After this use your custom `TusClient` subclass as you would normally use it. Here is an example:
108+
109+
```java
110+
@Override
111+
public void prepareConnection(@NotNull HttpURLConnection connection) {
112+
super.prepareConnection(connection);
113+
114+
if(connection instanceof HttpsURLConnection) {
115+
HttpsURLConnection secureConnection = (HttpsURLConnection) connection;
116+
secureConnection.setSSLSocketFactory(mySSLSocketFactory);
117+
}
118+
}
119+
```
120+
103121
## License
104122

105123
MIT

0 commit comments

Comments
 (0)