{"action":"created","issue":{"url":"https://api.github.com/repos/cryptobiu/scapi/issues/71","labels_url":"https://api.github.com/repos/cryptobiu/scapi/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/cryptobiu/scapi/issues/71/comments","events_url":"https://api.github.com/repos/cryptobiu/scapi/issues/71/events","html_url":"https://github.com/cryptobiu/scapi/issues/71","id":113055375,"number":71,"title":"ClassCastException when using AuthenticatedChannel","user":{"login":"tpj","id":2234124,"avatar_url":"https://avatars.githubusercontent.com/u/2234124?v=3","gravatar_id":"","url":"https://api.github.com/users/tpj","html_url":"https://github.com/tpj","followers_url":"https://api.github.com/users/tpj/followers","following_url":"https://api.github.com/users/tpj/following{/other_user}","gists_url":"https://api.github.com/users/tpj/gists{/gist_id}","starred_url":"https://api.github.com/users/tpj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpj/subscriptions","organizations_url":"https://api.github.com/users/tpj/orgs","repos_url":"https://api.github.com/users/tpj/repos","events_url":"https://api.github.com/users/tpj/events{/privacy}","received_events_url":"https://api.github.com/users/tpj/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-23T16:33:28Z","updated_at":"2015-10-25T12:38:58Z","closed_at":"2015-10-25T12:38:58Z","body":"Hi,\r\n\r\nWhen trying to create an authenticated channel as described in the documentation (http://scapi.readthedocs.org/en/latest/communication.html#security-of-the-connection), i.e., using this code:\r\n\r\n\tprivate AuthenticatedChannel createAuthenticatedChannel(Channel ch) throws Exception {\r\n\t\tMac mac = new ScCbcMacPrepending(new BcAES());\r\n\t\tbyte[] aesFixedKey = new byte[] { -61, -19, 106, -97, 106, 40, 52, -64, -115, -19, -87, -67, 98, 102, 16, 21 };\r\n\t\tSecretKey key = new SecretKeySpec(aesFixedKey, \"AES\");\r\n\t\tmac.setKey(key);\r\n\t\treturn new AuthenticatedChannel(ch, mac);\r\n\t}\r\n\r\nI get the following exception:\r\n\r\n    java.lang.ClassCastException: edu.biu.scapi.comm.twoPartyComm.PlainTCPSocketChannel cannot be cast to edu.biu.scapi.comm.PlainChannel\r\n    \tat edu.biu.scapi.comm.ChannelDecorator.<init>(ChannelDecorator.java:46)\r\n    \tat edu.biu.scapi.comm.AuthenticatedChannel.<init>(AuthenticatedChannel.java:94)\r\n        [snip]\r\n\r\nAt line 46 ChannelDecorator attempts to cast a PlainTCPSocketChannel to a PlainChannel, but PlainTCPSocketChannel is not an instance of PlainChannel...\r\n"},"comment":{"url":"https://api.github.com/repos/cryptobiu/scapi/issues/comments/150919911","html_url":"https://github.com/cryptobiu/scapi/issues/71#issuecomment-150919911","issue_url":"https://api.github.com/repos/cryptobiu/scapi/issues/71","id":150919911,"user":{"login":"AsafKleinbort","id":9512593,"avatar_url":"https://avatars.githubusercontent.com/u/9512593?v=3","gravatar_id":"","url":"https://api.github.com/users/AsafKleinbort","html_url":"https://github.com/AsafKleinbort","followers_url":"https://api.github.com/users/AsafKleinbort/followers","following_url":"https://api.github.com/users/AsafKleinbort/following{/other_user}","gists_url":"https://api.github.com/users/AsafKleinbort/gists{/gist_id}","starred_url":"https://api.github.com/users/AsafKleinbort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AsafKleinbort/subscriptions","organizations_url":"https://api.github.com/users/AsafKleinbort/orgs","repos_url":"https://api.github.com/users/AsafKleinbort/repos","events_url":"https://api.github.com/users/AsafKleinbort/events{/privacy}","received_events_url":"https://api.github.com/users/AsafKleinbort/received_events","type":"User","site_admin":false},"created_at":"2015-10-25T12:38:58Z","updated_at":"2015-10-25T12:38:58Z","body":"Hi,\r\nThanks for pointing it out.\r\n\r\nAs far as I see it there were two problems here.\r\n1. ChannelDecorator assumes implicitly that it receives an instance of PlainChannel\r\n2. PlainTCPSocketChannel is not an instance of PlainChannel\r\n\r\nI fixed both of the issue and pushed to master in: ac7194fd5b1880ba465ddffa5b7397d571ff0d51.\r\nAlso added a (very) simple test.\r\nIf you are using scapi from source it should be enough.\r\nIf you are using a binaries you'll need to re-build. Let me know if you need any help.\r\n\r\nBTW, with the current version you can workaround it by using another channel, e.g., PlainTCPChannel.\r\n"}}