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

Add proxy support for clients using AMQPS_WS #558

Merged
merged 3 commits into from
Jul 30, 2019
Merged

Conversation

timtay-microsoft
Copy link
Member

@timtay-microsoft timtay-microsoft commented Jul 17, 2019

Building on earlier work for proxy support for HTTPS, this PR enables AMQPS_WS to communicate over proxies now, too.

A part of this pr is migrating away from maintaining the Websocket layer implementation over proton-j, and instead taking a dependency on the proton-j-extensions jar, which is very similar, but also includes proxy support.

Also adding a simple sample for using proxy when sending telemetry

@azure-pipelines
Copy link

Azure Pipelines successfully started running 5 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

3 similar comments
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@timtay-microsoft timtay-microsoft force-pushed the proxyAmqp branch 3 times, most recently from c851ec0 to c67372c Compare July 26, 2019 18:27
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

2 similar comments
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@timtay-microsoft
Copy link
Member Author

/azp run Java Prod Basic

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@timtay-microsoft
Copy link
Member Author

/azp run Java Canary Basic

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -1185,29 +1208,6 @@ private String chooseHostname()
return this.deviceClientConfig.getIotHubHostname();
}

private String getErrorCondition(ErrorCondition condition)
Copy link
Member Author

Choose a reason for hiding this comment

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

This logic was unused, so I removed it

@timtay-microsoft
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 5 pipeline(s).

Copy link
Contributor

@davilu davilu left a comment

Choose a reason for hiding this comment

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

Several minor suggestions.

{
throw new UnsupportedOperationException("Cannot use proxy unsupported unless you are using HTTPS");
throw new UnsupportedOperationException("Use of proxies is unsupported unless using HTTPS or AMQPS_WS");
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be IllegalArgumentException instead of UnsupportedOperationException.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll address this in the next PR, sure


if (protocol == AMQPS_WS && proxySettings.getUsername() != null)
{
throw new UnsupportedOperationException("Use of username/password authentication is not supported for AMQPS_WS proxies");
Copy link
Contributor

Choose a reason for hiding this comment

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

The same as above.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll address this in the next PR, sure

@@ -557,7 +568,8 @@ public void onConnectionBound(Event event)
{
// Codes_SRS_AMQPSIOTHUBCONNECTION_25_049: [If websocket enabled the event handler shall configure the transport layer for websocket.]
WebSocketImpl webSocket = new WebSocketImpl();
webSocket.configure(this.hostName, WEB_SOCKET_PATH, 0, WEB_SOCKET_SUB_PROTOCOL, null, null);
String query = "iothub-no-client-cert=true";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a const for this magic string.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll address this in the next PR, sure

@@ -557,7 +568,8 @@ public void onConnectionBound(Event event)
{
// Codes_SRS_AMQPSIOTHUBCONNECTION_25_049: [If websocket enabled the event handler shall configure the transport layer for websocket.]
WebSocketImpl webSocket = new WebSocketImpl();
webSocket.configure(this.hostName, WEB_SOCKET_PATH, 0, WEB_SOCKET_SUB_PROTOCOL, null, null);
String query = "iothub-no-client-cert=true";
webSocket.configure(this.hostName, WEB_SOCKET_PATH, query, 443, WEB_SOCKET_SUB_PROTOCOL, null, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a const for HTTPS port 443.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll address this in the next PR, sure

//this.amqpSessionManager to sever the connection
//twinSubscribed = false;
}
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unused code if we don't have plan to support it.

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.

2 participants