diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java index 5beb5c487a..92510d6143 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java @@ -116,8 +116,12 @@ public class OAuthTokenValidaterStubFactory extends BasePoolableObjectFactory { if (hostURL.getProtocol().equals("https")) { // set up ssl factory since axis2 https transport is used. EasySSLProtocolSocketFactory sslProtocolSocketFactory = createProtocolSocketFactory(); - Protocol authhttps = new Protocol(hostURL.getProtocol() - , (ProtocolSocketFactory) sslProtocolSocketFactory, hostURL.getPort()); + int port = hostURL.getPort(); + if (port == -1) { + port = 443; + } + Protocol authhttps = new Protocol(hostURL.getProtocol(), + (ProtocolSocketFactory) sslProtocolSocketFactory, port); Protocol.registerProtocol(hostURL.getProtocol(), authhttps); options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, authhttps); } diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/src/main/java/org/wso2/carbon/device/mgt/extensions/remote.session/authentication/oauth/OAuthTokenValidatorStubFactory.java b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/src/main/java/org/wso2/carbon/device/mgt/extensions/remote.session/authentication/oauth/OAuthTokenValidatorStubFactory.java index 93a49160b2..399b08c011 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/src/main/java/org/wso2/carbon/device/mgt/extensions/remote.session/authentication/oauth/OAuthTokenValidatorStubFactory.java +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/src/main/java/org/wso2/carbon/device/mgt/extensions/remote.session/authentication/oauth/OAuthTokenValidatorStubFactory.java @@ -116,8 +116,12 @@ public class OAuthTokenValidatorStubFactory extends BasePoolableObjectFactory { if (hostURL.getProtocol().equals("https")) { // set up ssl factory since axis2 https notification is used. EasySSLProtocolSocketFactory sslProtocolSocketFactory = createProtocolSocketFactory(); - Protocol authhttps = new Protocol(hostURL.getProtocol() - , (ProtocolSocketFactory) sslProtocolSocketFactory, hostURL.getPort()); + int port = hostURL.getPort(); + if (port == -1) { + port = 443; + } + Protocol authhttps = new Protocol(hostURL.getProtocol(), + (ProtocolSocketFactory) sslProtocolSocketFactory, port); Protocol.registerProtocol(hostURL.getProtocol(), authhttps); options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, authhttps); }