Skip to content

Instantly share code, notes, and snippets.

View smourachov's full-sized avatar

Serguei smourachov

  • Tiny Speck
  • Vancouver
View GitHub Profile
@smourachov
smourachov / WebSocketClient.java
Created July 4, 2013 23:30
force using TLSv1.2
public static SocketFactory getSSLSocketFactory() throws NoSuchAlgorithmException, KeyManagementException {
return new SocketFactory() {
Socket getSoscket() {
try {
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, sTrustManagers, null);
SSLSocketFactory f = context.getSocketFactory();
Socket res = f.createSocket();