-
Notifications
You must be signed in to change notification settings - Fork 233
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
Conversation
Azure Pipelines successfully started running 5 pipeline(s). |
12a5c98
to
97215b0
Compare
Azure Pipelines successfully started running 1 pipeline(s). |
3 similar comments
Azure Pipelines successfully started running 1 pipeline(s). |
Azure Pipelines successfully started running 1 pipeline(s). |
Azure Pipelines successfully started running 1 pipeline(s). |
c851ec0
to
c67372c
Compare
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
Azure Pipelines successfully started running 1 pipeline(s). |
c67372c
to
24c9e39
Compare
Azure Pipelines successfully started running 1 pipeline(s). |
2 similar comments
Azure Pipelines successfully started running 1 pipeline(s). |
Azure Pipelines successfully started running 1 pipeline(s). |
24c9e39
to
4fbf2a1
Compare
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run Java Prod Basic |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run Java Canary Basic |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -1185,29 +1208,6 @@ private String chooseHostname() | |||
return this.deviceClientConfig.getIotHubHostname(); | |||
} | |||
|
|||
private String getErrorCondition(ErrorCondition condition) |
There was a problem hiding this comment.
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
/azp run |
Azure Pipelines successfully started running 5 pipeline(s). |
There was a problem hiding this 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"); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as above.
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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; | ||
} | ||
{ |
There was a problem hiding this comment.
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.
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