Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary code to create SSL conection in InputOfTest #1443

Closed
fabriciofx opened this issue Sep 6, 2020 · 10 comments
Closed

Remove unnecessary code to create SSL conection in InputOfTest #1443

fabriciofx opened this issue Sep 6, 2020 · 10 comments

Comments

@fabriciofx
Copy link
Contributor

fabriciofx commented Sep 6, 2020

InputOfTest#readsSecureUrlContent() uses the code bellow to create a SSL conection but isn't necessary and can be deleted.

        final TrustManager[] managers = {
            new X509TrustManager() {
                @Override
                public X509Certificate[] getAcceptedIssuers() {
                    return new X509Certificate[0];
                }

                @Override
                public void checkClientTrusted(
                    final X509Certificate[] cert, final String arg) {
                    // nothing to do
                }

                @Override
                public void checkServerTrusted(
                    final X509Certificate[] cert, final String arg) {
                    // nothing to do
                }
            },
        };
        final SSLContext context = SSLContext.getInstance("TLS");
        context.init(null, managers, new SecureRandom());
        HttpsURLConnection.setDefaultSSLSocketFactory(
            context.getSocketFactory()
        );
@0crat 0crat added the 0crat/new label Sep 6, 2020
@victornoel
Copy link
Collaborator

@fabriciofx indeed, I'm not sure why it was setup like that...

@victornoel
Copy link
Collaborator

@0crat in

@victornoel
Copy link
Collaborator

@fabriciofx let's use takes here to serve an https file without relying on an external web resource that requires internet connectivity to work.

@fabriciofx
Copy link
Contributor Author

@victornoel as I said here we can do it the same thing just using socket classes in JDK. Takes isn't necessary.

@victornoel
Copy link
Collaborator

victornoel commented Sep 6, 2020

@fabriciofx as concluded in #1444, since we will keep takes, let's try to use it to replace calls to external urls. In InputOfTest but also in any other test that do such http request.

@fabriciofx
Copy link
Contributor Author

@victornoel ok

andreoss added a commit to andreoss/cactoos that referenced this issue Apr 29, 2021
andreoss added a commit to andreoss/cactoos that referenced this issue Apr 29, 2021
andreoss added a commit to andreoss/cactoos that referenced this issue May 1, 2021
andreoss added a commit to andreoss/cactoos that referenced this issue May 1, 2021
@victornoel
Copy link
Collaborator

@andreoss sorry, I missed that the goal of the story was also to get rid of any call to external URLs by replacing them with using takes (or deleting them when unneeded as you did for HTTPS) as in the comment above (from me ^^). Could you check that there are no more of those or if there are, to fix them before we close this issue?

@andreoss
Copy link
Contributor

andreoss commented May 1, 2021

@victornoel It was the only one

@victornoel
Copy link
Collaborator

@andreoss excellent, thx

@0crat
Copy link
Collaborator

0crat commented May 2, 2021

Job gh:yegor256/cactoos#1443 is not assigned, can't get performer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants