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

[WebSocket] SSL Support for WebSocket Client. #205

Merged
merged 2 commits into from
Jun 21, 2018

Conversation

irunika
Copy link
Contributor

@irunika irunika commented Jun 18, 2018

Purpose

To add SSL support for WebSocket client.

Goals

Resolve #195

Automation tests

  • Unit tests

    Yes

  • Integration tests

    N/A

Security checks

@irunika irunika self-assigned this Jun 18, 2018
@irunika irunika force-pushed the websocket-listener-interface-change branch from ce8f4b1 to 1046484 Compare June 18, 2018 08:50
}
return Util.getSSLConfigForSender(certPass, keyStorePassword, keyStoreFile, trustStoreFile, trustStorePass,
parameters, sslProtocol, tlsStoreType);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we add javadoc to the public methods?

@@ -19,31 +19,15 @@

package org.wso2.transport.http.netty.contract.websocket;

import java.nio.ByteBuffer;

/**
* This message contains the details of WebSocket bong message.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a bong message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't know what a bong message is. Maybe this https://www.discogs.com/artist/7888-Bong-Messages :D
Anyway this is a typo and I will update this java doc with a valid description.

@irunika irunika force-pushed the websocket-listener-interface-change branch 7 times, most recently from c092c34 to d92d208 Compare June 19, 2018 04:40
* @param sslConfig ssl related configurations
* @return ssl engine
*/
private SSLEngine instantiateAndConfigSSL(SSLConfig sslConfig, String host, int port) {
Copy link
Member

@Bhashinee Bhashinee Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use the same instantiateAndConfigSSL(..) method in Util class making it public?

Assert.assertNotNull(throwable);
Assert.assertTrue(throwable instanceof IllegalArgumentException);
Assert.assertEquals(throwable.getMessage(),
"TrustStoreFile or trustStorePassword not defined for HTTPS/WSS_SCHEME scheme");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be '... HTTPS/WSS scheme'

Assert.assertEquals(throwable.getMessage(), "General SSLEngine problem");
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we remove these 2 empty lines?

Assert.assertEquals(clientConnectorListener.getReceivedTextToClient(), testText);
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we remove these 2 empty lines?

@irunika irunika force-pushed the websocket-listener-interface-change branch 7 times, most recently from e47f3aa to e2f9183 Compare June 20, 2018 05:00
private void configureHandshakePipeline(ChannelPipeline pipeline) {
pipeline.addLast(new HttpClientCodec());
// Assuming that WebSocket Handshake messages will not be large than 8KB
pipeline.addLast(new HttpObjectAggregator(8192)); // TODO: Use constant if has
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the TODO here?

return 443;
default:
return -1;
case "ws": // TODO: Constants
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we fix the TODO here?

this.clientHandshakeFuture = clientHandshakeFuture;
}

@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect formatting

import static org.wso2.transport.http.netty.util.TestUtil.WEBSOCKET_TEST_IDLE_TIMEOUT;
import static java.util.concurrent.TimeUnit.SECONDS;

public class WebSocketSSLHandshakeFailureTestCase {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we add a class java doc?

@@ -82,6 +82,8 @@
<class name="org.wso2.transport.http.netty.websocket.client.WebSocketClientHandshakeFunctionalityTestCase"/>
<class name="org.wso2.transport.http.netty.websocket.client.WebSocketClientFunctionalityTestCase"/>
<class name="org.wso2.transport.http.netty.websocket.passthrough.WebSocketPassThroughTestCase"/>
<class name="org.wso2.transport.http.netty.websocket.ssl.WebSocketSSLHandshakeSuccessfulTestCase"/>
<class name="org.wso2.transport.http.netty.websocket.ssl.WebSocketSSLHandshakeFailureTestCase"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we add the org.wso2.transport.http.netty.websocket package instead of individual classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done as a separate task for all the test cases after a careful inspection.
Created a issue to track this #212

@irunika irunika force-pushed the websocket-listener-interface-change branch from e2f9183 to 88a504f Compare June 20, 2018 06:41
@irunika irunika force-pushed the websocket-listener-interface-change branch from 88a504f to 17acfa8 Compare June 20, 2018 08:41
@irunika irunika force-pushed the websocket-listener-interface-change branch from 17acfa8 to 9cfb53a Compare June 21, 2018 03:19
@irunika irunika merged commit b887703 into wso2:master Jun 21, 2018
Bhashinee pushed a commit to Bhashinee/transport-http that referenced this pull request Aug 20, 2018
Bhashinee pushed a commit to Bhashinee/transport-http that referenced this pull request Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants