You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3267 lines
89 KiB
3267 lines
89 KiB
2 years ago
|
.class public Lorg/java_websocket/WebSocketImpl;
|
||
|
.super Ljava/lang/Object;
|
||
|
.source "WebSocketImpl.java"
|
||
|
|
||
|
# interfaces
|
||
|
.implements Lorg/java_websocket/WebSocket;
|
||
|
|
||
|
|
||
|
# static fields
|
||
|
.field static final synthetic $assertionsDisabled:Z
|
||
|
|
||
|
.field public static DEBUG:Z
|
||
|
|
||
|
.field public static RCVBUF:I
|
||
|
|
||
|
.field public static final defaultdraftlist:Ljava/util/List;
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"Ljava/util/List",
|
||
|
"<",
|
||
|
"Lorg/java_websocket/drafts/Draft;",
|
||
|
">;"
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
|
||
|
# instance fields
|
||
|
.field public channel:Ljava/nio/channels/ByteChannel;
|
||
|
|
||
|
.field private closecode:Ljava/lang/Integer;
|
||
|
|
||
|
.field private closedremotely:Ljava/lang/Boolean;
|
||
|
|
||
|
.field private closemessage:Ljava/lang/String;
|
||
|
|
||
|
.field private current_continuous_frame_opcode:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
.field private draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
.field private volatile flushandclosestate:Z
|
||
|
|
||
|
.field private handshakerequest:Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
.field public final inQueue:Ljava/util/concurrent/BlockingQueue;
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"Ljava/util/concurrent/BlockingQueue",
|
||
|
"<",
|
||
|
"Ljava/nio/ByteBuffer;",
|
||
|
">;"
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field public key:Ljava/nio/channels/SelectionKey;
|
||
|
|
||
|
.field private knownDrafts:Ljava/util/List;
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"Ljava/util/List",
|
||
|
"<",
|
||
|
"Lorg/java_websocket/drafts/Draft;",
|
||
|
">;"
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field public final outQueue:Ljava/util/concurrent/BlockingQueue;
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"Ljava/util/concurrent/BlockingQueue",
|
||
|
"<",
|
||
|
"Ljava/nio/ByteBuffer;",
|
||
|
">;"
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field private readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
.field private resourceDescriptor:Ljava/lang/String;
|
||
|
|
||
|
.field private role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
.field private tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.field public volatile workerThread:Lorg/java_websocket/server/WebSocketServer$WebSocketWorker;
|
||
|
|
||
|
.field private final wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
|
||
|
# direct methods
|
||
|
.method static constructor <clinit>()V
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
.line 44
|
||
|
const-class v0, Lorg/java_websocket/WebSocketImpl;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/Class;->desiredAssertionStatus()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
:goto_0
|
||
|
sput-boolean v0, Lorg/java_websocket/WebSocketImpl;->$assertionsDisabled:Z
|
||
|
|
||
|
.line 46
|
||
|
new-instance v0, Ljava/util/ArrayList;
|
||
|
|
||
|
const/4 v2, 0x4
|
||
|
|
||
|
invoke-direct {v0, v2}, Ljava/util/ArrayList;-><init>(I)V
|
||
|
|
||
|
sput-object v0, Lorg/java_websocket/WebSocketImpl;->defaultdraftlist:Ljava/util/List;
|
||
|
|
||
|
.line 47
|
||
|
const/16 v0, 0x4000
|
||
|
|
||
|
sput v0, Lorg/java_websocket/WebSocketImpl;->RCVBUF:I
|
||
|
|
||
|
.line 48
|
||
|
sput-boolean v1, Lorg/java_websocket/WebSocketImpl;->DEBUG:Z
|
||
|
|
||
|
.line 51
|
||
|
sget-object v0, Lorg/java_websocket/WebSocketImpl;->defaultdraftlist:Ljava/util/List;
|
||
|
|
||
|
new-instance v1, Lorg/java_websocket/drafts/Draft_17;
|
||
|
|
||
|
invoke-direct {v1}, Lorg/java_websocket/drafts/Draft_17;-><init>()V
|
||
|
|
||
|
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
||
|
|
||
|
.line 52
|
||
|
sget-object v0, Lorg/java_websocket/WebSocketImpl;->defaultdraftlist:Ljava/util/List;
|
||
|
|
||
|
new-instance v1, Lorg/java_websocket/drafts/Draft_10;
|
||
|
|
||
|
invoke-direct {v1}, Lorg/java_websocket/drafts/Draft_10;-><init>()V
|
||
|
|
||
|
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
||
|
|
||
|
.line 53
|
||
|
sget-object v0, Lorg/java_websocket/WebSocketImpl;->defaultdraftlist:Ljava/util/List;
|
||
|
|
||
|
new-instance v1, Lorg/java_websocket/drafts/Draft_76;
|
||
|
|
||
|
invoke-direct {v1}, Lorg/java_websocket/drafts/Draft_76;-><init>()V
|
||
|
|
||
|
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
||
|
|
||
|
.line 54
|
||
|
sget-object v0, Lorg/java_websocket/WebSocketImpl;->defaultdraftlist:Ljava/util/List;
|
||
|
|
||
|
new-instance v1, Lorg/java_websocket/drafts/Draft_75;
|
||
|
|
||
|
invoke-direct {v1}, Lorg/java_websocket/drafts/Draft_75;-><init>()V
|
||
|
|
||
|
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
||
|
|
||
|
.line 55
|
||
|
return-void
|
||
|
|
||
|
:cond_0
|
||
|
move v0, v1
|
||
|
|
||
|
.line 44
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method public constructor <init>(Lorg/java_websocket/WebSocketListener;Ljava/util/List;)V
|
||
|
.locals 1
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"(",
|
||
|
"Lorg/java_websocket/WebSocketListener;",
|
||
|
"Ljava/util/List",
|
||
|
"<",
|
||
|
"Lorg/java_websocket/drafts/Draft;",
|
||
|
">;)V"
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
.prologue
|
||
|
.line 111
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
check-cast v0, Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-direct {p0, p1, v0}, Lorg/java_websocket/WebSocketImpl;-><init>(Lorg/java_websocket/WebSocketListener;Lorg/java_websocket/drafts/Draft;)V
|
||
|
|
||
|
.line 112
|
||
|
sget-object v0, Lorg/java_websocket/WebSocket$Role;->SERVER:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
.line 114
|
||
|
if-eqz p2, :cond_0
|
||
|
|
||
|
invoke-interface {p2}, Ljava/util/List;->isEmpty()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
.line 115
|
||
|
:cond_0
|
||
|
sget-object v0, Lorg/java_websocket/WebSocketImpl;->defaultdraftlist:Ljava/util/List;
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->knownDrafts:Ljava/util/List;
|
||
|
|
||
|
.line 119
|
||
|
:goto_0
|
||
|
return-void
|
||
|
|
||
|
.line 117
|
||
|
:cond_1
|
||
|
iput-object p2, p0, Lorg/java_websocket/WebSocketImpl;->knownDrafts:Ljava/util/List;
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method public constructor <init>(Lorg/java_websocket/WebSocketListener;Ljava/util/List;Ljava/net/Socket;)V
|
||
|
.locals 0
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"(",
|
||
|
"Lorg/java_websocket/WebSocketListener;",
|
||
|
"Ljava/util/List",
|
||
|
"<",
|
||
|
"Lorg/java_websocket/drafts/Draft;",
|
||
|
">;",
|
||
|
"Ljava/net/Socket;",
|
||
|
")V"
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
.annotation runtime Ljava/lang/Deprecated;
|
||
|
.end annotation
|
||
|
|
||
|
.prologue
|
||
|
.line 144
|
||
|
invoke-direct {p0, p1, p2}, Lorg/java_websocket/WebSocketImpl;-><init>(Lorg/java_websocket/WebSocketListener;Ljava/util/List;)V
|
||
|
|
||
|
.line 145
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public constructor <init>(Lorg/java_websocket/WebSocketListener;Lorg/java_websocket/drafts/Draft;)V
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
.line 126
|
||
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||
|
|
||
|
.line 81
|
||
|
iput-boolean v2, p0, Lorg/java_websocket/WebSocketImpl;->flushandclosestate:Z
|
||
|
|
||
|
.line 82
|
||
|
sget-object v0, Lorg/java_websocket/WebSocket$READYSTATE;->NOT_YET_CONNECTED:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
.line 85
|
||
|
iput-object v1, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
.line 89
|
||
|
iput-object v1, p0, Lorg/java_websocket/WebSocketImpl;->current_continuous_frame_opcode:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
.line 94
|
||
|
invoke-static {v2}, Ljava/nio/ByteBuffer;->allocate(I)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.line 99
|
||
|
iput-object v1, p0, Lorg/java_websocket/WebSocketImpl;->handshakerequest:Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
.line 101
|
||
|
iput-object v1, p0, Lorg/java_websocket/WebSocketImpl;->closemessage:Ljava/lang/String;
|
||
|
|
||
|
.line 102
|
||
|
iput-object v1, p0, Lorg/java_websocket/WebSocketImpl;->closecode:Ljava/lang/Integer;
|
||
|
|
||
|
.line 103
|
||
|
iput-object v1, p0, Lorg/java_websocket/WebSocketImpl;->closedremotely:Ljava/lang/Boolean;
|
||
|
|
||
|
.line 105
|
||
|
iput-object v1, p0, Lorg/java_websocket/WebSocketImpl;->resourceDescriptor:Ljava/lang/String;
|
||
|
|
||
|
.line 127
|
||
|
if-eqz p1, :cond_0
|
||
|
|
||
|
if-nez p2, :cond_1
|
||
|
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$Role;->SERVER:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
if-ne v0, v1, :cond_1
|
||
|
|
||
|
.line 128
|
||
|
:cond_0
|
||
|
new-instance v0, Ljava/lang/IllegalArgumentException;
|
||
|
|
||
|
const-string v1, "parameters must not be null"
|
||
|
|
||
|
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 129
|
||
|
:cond_1
|
||
|
new-instance v0, Ljava/util/concurrent/LinkedBlockingQueue;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/util/concurrent/LinkedBlockingQueue;-><init>()V
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->outQueue:Ljava/util/concurrent/BlockingQueue;
|
||
|
|
||
|
.line 130
|
||
|
new-instance v0, Ljava/util/concurrent/LinkedBlockingQueue;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/util/concurrent/LinkedBlockingQueue;-><init>()V
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->inQueue:Ljava/util/concurrent/BlockingQueue;
|
||
|
|
||
|
.line 131
|
||
|
iput-object p1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
.line 132
|
||
|
sget-object v0, Lorg/java_websocket/WebSocket$Role;->CLIENT:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
.line 133
|
||
|
if-eqz p2, :cond_2
|
||
|
|
||
|
.line 134
|
||
|
invoke-virtual {p2}, Lorg/java_websocket/drafts/Draft;->copyInstance()Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
.line 135
|
||
|
:cond_2
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public constructor <init>(Lorg/java_websocket/WebSocketListener;Lorg/java_websocket/drafts/Draft;Ljava/net/Socket;)V
|
||
|
.locals 0
|
||
|
.annotation runtime Ljava/lang/Deprecated;
|
||
|
.end annotation
|
||
|
|
||
|
.prologue
|
||
|
.line 139
|
||
|
invoke-direct {p0, p1, p2}, Lorg/java_websocket/WebSocketImpl;-><init>(Lorg/java_websocket/WebSocketListener;Lorg/java_websocket/drafts/Draft;)V
|
||
|
|
||
|
.line 140
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method private close(ILjava/lang/String;Z)V
|
||
|
.locals 5
|
||
|
|
||
|
.prologue
|
||
|
const/16 v4, 0x3ee
|
||
|
|
||
|
const/4 v3, -0x3
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
.line 398
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->CLOSING:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-eq v0, v1, :cond_1
|
||
|
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->CLOSED:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-eq v0, v1, :cond_1
|
||
|
|
||
|
.line 399
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->OPEN:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-ne v0, v1, :cond_6
|
||
|
|
||
|
.line 400
|
||
|
if-ne p1, v4, :cond_2
|
||
|
|
||
|
.line 401
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->$assertionsDisabled:Z
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
if-eqz p3, :cond_0
|
||
|
|
||
|
new-instance v0, Ljava/lang/AssertionError;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 402
|
||
|
:cond_0
|
||
|
sget-object v0, Lorg/java_websocket/WebSocket$READYSTATE;->CLOSING:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
.line 403
|
||
|
invoke-virtual {p0, p1, p2, v2}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
.line 434
|
||
|
:cond_1
|
||
|
:goto_0
|
||
|
return-void
|
||
|
|
||
|
.line 406
|
||
|
:cond_2
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v0}, Lorg/java_websocket/drafts/Draft;->getCloseHandshakeType()Lorg/java_websocket/drafts/Draft$CloseHandshakeType;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/drafts/Draft$CloseHandshakeType;->NONE:Lorg/java_websocket/drafts/Draft$CloseHandshakeType;
|
||
|
|
||
|
if-eq v0, v1, :cond_4
|
||
|
|
||
|
.line 408
|
||
|
if-nez p3, :cond_3
|
||
|
|
||
|
.line 410
|
||
|
:try_start_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v0, p0, p1, p2}, Lorg/java_websocket/WebSocketListener;->onWebsocketCloseInitiated(Lorg/java_websocket/WebSocket;ILjava/lang/String;)V
|
||
|
:try_end_0
|
||
|
.catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_0 .. :try_end_0} :catch_1
|
||
|
|
||
|
.line 415
|
||
|
:cond_3
|
||
|
:goto_1
|
||
|
:try_start_1
|
||
|
new-instance v0, Lorg/java_websocket/framing/CloseFrameBuilder;
|
||
|
|
||
|
invoke-direct {v0, p1, p2}, Lorg/java_websocket/framing/CloseFrameBuilder;-><init>(ILjava/lang/String;)V
|
||
|
|
||
|
invoke-virtual {p0, v0}, Lorg/java_websocket/WebSocketImpl;->sendFrame(Lorg/java_websocket/framing/Framedata;)V
|
||
|
:try_end_1
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_1 .. :try_end_1} :catch_1
|
||
|
|
||
|
.line 421
|
||
|
:cond_4
|
||
|
:goto_2
|
||
|
invoke-virtual {p0, p1, p2, p3}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
.line 428
|
||
|
:goto_3
|
||
|
const/16 v0, 0x3ea
|
||
|
|
||
|
if-ne p1, v0, :cond_5
|
||
|
|
||
|
.line 429
|
||
|
invoke-virtual {p0, p1, p2, p3}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
.line 430
|
||
|
:cond_5
|
||
|
sget-object v0, Lorg/java_websocket/WebSocket$READYSTATE;->CLOSING:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
.line 431
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 411
|
||
|
:catch_0
|
||
|
move-exception v0
|
||
|
|
||
|
.line 412
|
||
|
:try_start_2
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
:try_end_2
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_2 .. :try_end_2} :catch_1
|
||
|
|
||
|
goto :goto_1
|
||
|
|
||
|
.line 416
|
||
|
:catch_1
|
||
|
move-exception v0
|
||
|
|
||
|
.line 417
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
|
||
|
.line 418
|
||
|
const-string v0, "generated frame is invalid"
|
||
|
|
||
|
invoke-virtual {p0, v4, v0, v2}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
goto :goto_2
|
||
|
|
||
|
.line 422
|
||
|
:cond_6
|
||
|
if-ne p1, v3, :cond_8
|
||
|
|
||
|
.line 423
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->$assertionsDisabled:Z
|
||
|
|
||
|
if-nez v0, :cond_7
|
||
|
|
||
|
if-nez p3, :cond_7
|
||
|
|
||
|
new-instance v0, Ljava/lang/AssertionError;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 424
|
||
|
:cond_7
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
invoke-virtual {p0, v3, p2, v0}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
goto :goto_3
|
||
|
|
||
|
.line 426
|
||
|
:cond_8
|
||
|
const/4 v0, -0x1
|
||
|
|
||
|
invoke-virtual {p0, v0, p2, v2}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
goto :goto_3
|
||
|
.end method
|
||
|
|
||
|
.method private decodeFrames(Ljava/nio/ByteBuffer;)V
|
||
|
.locals 5
|
||
|
|
||
|
.prologue
|
||
|
.line 322
|
||
|
:try_start_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v0, p1}, Lorg/java_websocket/drafts/Draft;->translateFrame(Ljava/nio/ByteBuffer;)Ljava/util/List;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
.line 323
|
||
|
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
:goto_0
|
||
|
invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
check-cast v0, Lorg/java_websocket/framing/Framedata;
|
||
|
|
||
|
.line 324
|
||
|
sget-boolean v1, Lorg/java_websocket/WebSocketImpl;->DEBUG:Z
|
||
|
|
||
|
if-eqz v1, :cond_0
|
||
|
|
||
|
.line 325
|
||
|
sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
|
||
|
|
||
|
new-instance v2, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v4, "matched frame: "
|
||
|
|
||
|
invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
|
||
|
|
||
|
.line 326
|
||
|
:cond_0
|
||
|
invoke-interface {v0}, Lorg/java_websocket/framing/Framedata;->getOpcode()Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
.line 327
|
||
|
invoke-interface {v0}, Lorg/java_websocket/framing/Framedata;->isFin()Z
|
||
|
|
||
|
move-result v2
|
||
|
|
||
|
.line 329
|
||
|
sget-object v4, Lorg/java_websocket/framing/Framedata$Opcode;->CLOSING:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
if-ne v1, v4, :cond_4
|
||
|
|
||
|
.line 330
|
||
|
const/16 v2, 0x3ed
|
||
|
|
||
|
.line 331
|
||
|
const-string v1, ""
|
||
|
|
||
|
.line 332
|
||
|
instance-of v4, v0, Lorg/java_websocket/framing/CloseFrame;
|
||
|
|
||
|
if-eqz v4, :cond_11
|
||
|
|
||
|
.line 333
|
||
|
check-cast v0, Lorg/java_websocket/framing/CloseFrame;
|
||
|
|
||
|
.line 334
|
||
|
invoke-interface {v0}, Lorg/java_websocket/framing/CloseFrame;->getCloseCode()I
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
.line 335
|
||
|
invoke-interface {v0}, Lorg/java_websocket/framing/CloseFrame;->getMessage()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
.line 337
|
||
|
:goto_1
|
||
|
iget-object v2, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v4, Lorg/java_websocket/WebSocket$READYSTATE;->CLOSING:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-ne v2, v4, :cond_2
|
||
|
|
||
|
.line 339
|
||
|
const/4 v2, 0x1
|
||
|
|
||
|
invoke-virtual {p0, v1, v0, v2}, Lorg/java_websocket/WebSocketImpl;->closeConnection(ILjava/lang/String;Z)V
|
||
|
:try_end_0
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_0 .. :try_end_0} :catch_0
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 390
|
||
|
:catch_0
|
||
|
move-exception v0
|
||
|
|
||
|
.line 391
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
|
||
|
.line 392
|
||
|
invoke-virtual {p0, v0}, Lorg/java_websocket/WebSocketImpl;->close(Lorg/java_websocket/exceptions/InvalidDataException;)V
|
||
|
|
||
|
.line 395
|
||
|
:cond_1
|
||
|
return-void
|
||
|
|
||
|
.line 342
|
||
|
:cond_2
|
||
|
:try_start_1
|
||
|
iget-object v2, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v2}, Lorg/java_websocket/drafts/Draft;->getCloseHandshakeType()Lorg/java_websocket/drafts/Draft$CloseHandshakeType;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
sget-object v4, Lorg/java_websocket/drafts/Draft$CloseHandshakeType;->TWOWAY:Lorg/java_websocket/drafts/Draft$CloseHandshakeType;
|
||
|
|
||
|
if-ne v2, v4, :cond_3
|
||
|
|
||
|
.line 343
|
||
|
const/4 v2, 0x1
|
||
|
|
||
|
invoke-direct {p0, v1, v0, v2}, Lorg/java_websocket/WebSocketImpl;->close(ILjava/lang/String;Z)V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 345
|
||
|
:cond_3
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
invoke-virtual {p0, v1, v0, v2}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 348
|
||
|
:cond_4
|
||
|
sget-object v4, Lorg/java_websocket/framing/Framedata$Opcode;->PING:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
if-ne v1, v4, :cond_5
|
||
|
|
||
|
.line 349
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketPing(Lorg/java_websocket/WebSocket;Lorg/java_websocket/framing/Framedata;)V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 351
|
||
|
:cond_5
|
||
|
sget-object v4, Lorg/java_websocket/framing/Framedata$Opcode;->PONG:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
if-ne v1, v4, :cond_6
|
||
|
|
||
|
.line 352
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketPong(Lorg/java_websocket/WebSocket;Lorg/java_websocket/framing/Framedata;)V
|
||
|
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
.line 354
|
||
|
:cond_6
|
||
|
if-eqz v2, :cond_7
|
||
|
|
||
|
sget-object v4, Lorg/java_websocket/framing/Framedata$Opcode;->CONTINUOUS:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
if-ne v1, v4, :cond_d
|
||
|
|
||
|
.line 355
|
||
|
:cond_7
|
||
|
sget-object v4, Lorg/java_websocket/framing/Framedata$Opcode;->CONTINUOUS:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
if-eq v1, v4, :cond_a
|
||
|
|
||
|
.line 356
|
||
|
iget-object v2, p0, Lorg/java_websocket/WebSocketImpl;->current_continuous_frame_opcode:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
if-eqz v2, :cond_8
|
||
|
|
||
|
.line 357
|
||
|
new-instance v0, Lorg/java_websocket/exceptions/InvalidDataException;
|
||
|
|
||
|
const/16 v1, 0x3ea
|
||
|
|
||
|
const-string v2, "Previous continuous frame sequence not completed."
|
||
|
|
||
|
invoke-direct {v0, v1, v2}, Lorg/java_websocket/exceptions/InvalidDataException;-><init>(ILjava/lang/String;)V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 358
|
||
|
:cond_8
|
||
|
iput-object v1, p0, Lorg/java_websocket/WebSocketImpl;->current_continuous_frame_opcode:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
:try_end_1
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_1 .. :try_end_1} :catch_0
|
||
|
|
||
|
.line 367
|
||
|
:cond_9
|
||
|
:goto_2
|
||
|
:try_start_2
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketMessageFragment(Lorg/java_websocket/WebSocket;Lorg/java_websocket/framing/Framedata;)V
|
||
|
:try_end_2
|
||
|
.catch Ljava/lang/RuntimeException; {:try_start_2 .. :try_end_2} :catch_1
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_2 .. :try_end_2} :catch_0
|
||
|
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
.line 368
|
||
|
:catch_1
|
||
|
move-exception v0
|
||
|
|
||
|
.line 369
|
||
|
:try_start_3
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
.line 359
|
||
|
:cond_a
|
||
|
if-eqz v2, :cond_c
|
||
|
|
||
|
.line 360
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->current_continuous_frame_opcode:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
if-nez v1, :cond_b
|
||
|
|
||
|
.line 361
|
||
|
new-instance v0, Lorg/java_websocket/exceptions/InvalidDataException;
|
||
|
|
||
|
const/16 v1, 0x3ea
|
||
|
|
||
|
const-string v2, "Continuous frame sequence was not started."
|
||
|
|
||
|
invoke-direct {v0, v1, v2}, Lorg/java_websocket/exceptions/InvalidDataException;-><init>(ILjava/lang/String;)V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 362
|
||
|
:cond_b
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
iput-object v1, p0, Lorg/java_websocket/WebSocketImpl;->current_continuous_frame_opcode:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
goto :goto_2
|
||
|
|
||
|
.line 363
|
||
|
:cond_c
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->current_continuous_frame_opcode:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
if-nez v1, :cond_9
|
||
|
|
||
|
.line 364
|
||
|
new-instance v0, Lorg/java_websocket/exceptions/InvalidDataException;
|
||
|
|
||
|
const/16 v1, 0x3ea
|
||
|
|
||
|
const-string v2, "Continuous frame sequence was not started."
|
||
|
|
||
|
invoke-direct {v0, v1, v2}, Lorg/java_websocket/exceptions/InvalidDataException;-><init>(ILjava/lang/String;)V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 372
|
||
|
:cond_d
|
||
|
iget-object v2, p0, Lorg/java_websocket/WebSocketImpl;->current_continuous_frame_opcode:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
|
||
|
if-eqz v2, :cond_e
|
||
|
|
||
|
.line 373
|
||
|
new-instance v0, Lorg/java_websocket/exceptions/InvalidDataException;
|
||
|
|
||
|
const/16 v1, 0x3ea
|
||
|
|
||
|
const-string v2, "Continuous frame sequence not completed."
|
||
|
|
||
|
invoke-direct {v0, v1, v2}, Lorg/java_websocket/exceptions/InvalidDataException;-><init>(ILjava/lang/String;)V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 374
|
||
|
:cond_e
|
||
|
sget-object v2, Lorg/java_websocket/framing/Framedata$Opcode;->TEXT:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
:try_end_3
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_3 .. :try_end_3} :catch_0
|
||
|
|
||
|
if-ne v1, v2, :cond_f
|
||
|
|
||
|
.line 376
|
||
|
:try_start_4
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v0}, Lorg/java_websocket/framing/Framedata;->getPayloadData()Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-static {v0}, Lorg/java_websocket/util/Charsetfunctions;->stringUtf8(Ljava/nio/ByteBuffer;)Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketMessage(Lorg/java_websocket/WebSocket;Ljava/lang/String;)V
|
||
|
:try_end_4
|
||
|
.catch Ljava/lang/RuntimeException; {:try_start_4 .. :try_end_4} :catch_2
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_4 .. :try_end_4} :catch_0
|
||
|
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
.line 377
|
||
|
:catch_2
|
||
|
move-exception v0
|
||
|
|
||
|
.line 378
|
||
|
:try_start_5
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
.line 380
|
||
|
:cond_f
|
||
|
sget-object v2, Lorg/java_websocket/framing/Framedata$Opcode;->BINARY:Lorg/java_websocket/framing/Framedata$Opcode;
|
||
|
:try_end_5
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_5 .. :try_end_5} :catch_0
|
||
|
|
||
|
if-ne v1, v2, :cond_10
|
||
|
|
||
|
.line 382
|
||
|
:try_start_6
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v0}, Lorg/java_websocket/framing/Framedata;->getPayloadData()Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketMessage(Lorg/java_websocket/WebSocket;Ljava/nio/ByteBuffer;)V
|
||
|
:try_end_6
|
||
|
.catch Ljava/lang/RuntimeException; {:try_start_6 .. :try_end_6} :catch_3
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_6 .. :try_end_6} :catch_0
|
||
|
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
.line 383
|
||
|
:catch_3
|
||
|
move-exception v0
|
||
|
|
||
|
.line 384
|
||
|
:try_start_7
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
.line 387
|
||
|
:cond_10
|
||
|
new-instance v0, Lorg/java_websocket/exceptions/InvalidDataException;
|
||
|
|
||
|
const/16 v1, 0x3ea
|
||
|
|
||
|
const-string v2, "non control or continious frame expected"
|
||
|
|
||
|
invoke-direct {v0, v1, v2}, Lorg/java_websocket/exceptions/InvalidDataException;-><init>(ILjava/lang/String;)V
|
||
|
|
||
|
throw v0
|
||
|
:try_end_7
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_7 .. :try_end_7} :catch_0
|
||
|
|
||
|
:cond_11
|
||
|
move-object v0, v1
|
||
|
|
||
|
move v1, v2
|
||
|
|
||
|
goto/16 :goto_1
|
||
|
.end method
|
||
|
|
||
|
.method private decodeHandshake(Ljava/nio/ByteBuffer;)Z
|
||
|
.locals 8
|
||
|
|
||
|
.prologue
|
||
|
const/4 v3, 0x1
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
.line 179
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->capacity()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
move-object v1, p1
|
||
|
|
||
|
.line 193
|
||
|
:goto_0
|
||
|
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->mark()Ljava/nio/Buffer;
|
||
|
|
||
|
.line 195
|
||
|
:try_start_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
if-nez v0, :cond_4
|
||
|
|
||
|
.line 196
|
||
|
invoke-direct {p0, v1}, Lorg/java_websocket/WebSocketImpl;->isFlashEdgeCase(Ljava/nio/ByteBuffer;)Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
.line 197
|
||
|
sget-object v4, Lorg/java_websocket/drafts/Draft$HandshakeState;->MATCHED:Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
:try_end_0
|
||
|
.catch Lorg/java_websocket/exceptions/IncompleteHandshakeException; {:try_start_0 .. :try_end_0} :catch_1
|
||
|
|
||
|
if-ne v0, v4, :cond_4
|
||
|
|
||
|
.line 199
|
||
|
:try_start_1
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v0, p0}, Lorg/java_websocket/WebSocketListener;->getFlashPolicy(Lorg/java_websocket/WebSocket;)Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-static {v0}, Lorg/java_websocket/util/Charsetfunctions;->utf8Bytes(Ljava/lang/String;)[B
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-static {v0}, Ljava/nio/ByteBuffer;->wrap([B)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-direct {p0, v0}, Lorg/java_websocket/WebSocketImpl;->write(Ljava/nio/ByteBuffer;)V
|
||
|
|
||
|
.line 200
|
||
|
const/4 v0, -0x3
|
||
|
|
||
|
const-string v3, ""
|
||
|
|
||
|
invoke-virtual {p0, v0, v3}, Lorg/java_websocket/WebSocketImpl;->close(ILjava/lang/String;)V
|
||
|
:try_end_1
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_1 .. :try_end_1} :catch_0
|
||
|
.catch Lorg/java_websocket/exceptions/IncompleteHandshakeException; {:try_start_1 .. :try_end_1} :catch_1
|
||
|
|
||
|
:goto_1
|
||
|
move v0, v2
|
||
|
|
||
|
.line 315
|
||
|
:goto_2
|
||
|
return v0
|
||
|
|
||
|
.line 182
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->remaining()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
if-ge v0, v1, :cond_1
|
||
|
|
||
|
.line 183
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->capacity()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
add-int/2addr v0, v1
|
||
|
|
||
|
invoke-static {v0}, Ljava/nio/ByteBuffer;->allocate(I)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
.line 184
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->flip()Ljava/nio/Buffer;
|
||
|
|
||
|
.line 185
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v0, v1}, Ljava/nio/ByteBuffer;->put(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.line 186
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.line 189
|
||
|
:cond_1
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v0, p1}, Ljava/nio/ByteBuffer;->put(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.line 190
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->flip()Ljava/nio/Buffer;
|
||
|
|
||
|
.line 191
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-object v1, v0
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 201
|
||
|
:catch_0
|
||
|
move-exception v0
|
||
|
|
||
|
.line 202
|
||
|
const/16 v0, 0x3ee
|
||
|
|
||
|
:try_start_2
|
||
|
const-string v3, "remote peer closed connection before flashpolicy could be transmitted"
|
||
|
|
||
|
const/4 v4, 0x1
|
||
|
|
||
|
invoke-direct {p0, v0, v3, v4}, Lorg/java_websocket/WebSocketImpl;->close(ILjava/lang/String;Z)V
|
||
|
:try_end_2
|
||
|
.catch Lorg/java_websocket/exceptions/IncompleteHandshakeException; {:try_start_2 .. :try_end_2} :catch_1
|
||
|
|
||
|
goto :goto_1
|
||
|
|
||
|
.line 297
|
||
|
:catch_1
|
||
|
move-exception v0
|
||
|
|
||
|
move-object v3, v0
|
||
|
|
||
|
.line 298
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->capacity()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-nez v0, :cond_10
|
||
|
|
||
|
.line 299
|
||
|
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->reset()Ljava/nio/Buffer;
|
||
|
|
||
|
.line 300
|
||
|
invoke-virtual {v3}, Lorg/java_websocket/exceptions/IncompleteHandshakeException;->getPreferedSize()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
.line 301
|
||
|
if-nez v0, :cond_f
|
||
|
|
||
|
.line 302
|
||
|
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->capacity()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
add-int/lit8 v0, v0, 0x10
|
||
|
|
||
|
.line 306
|
||
|
:cond_2
|
||
|
invoke-static {v0}, Ljava/nio/ByteBuffer;->allocate(I)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.line 308
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v0, p1}, Ljava/nio/ByteBuffer;->put(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
:cond_3
|
||
|
:goto_3
|
||
|
move v0, v2
|
||
|
|
||
|
.line 315
|
||
|
goto :goto_2
|
||
|
|
||
|
.line 210
|
||
|
:cond_4
|
||
|
:try_start_3
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
sget-object v4, Lorg/java_websocket/WebSocket$Role;->SERVER:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
if-ne v0, v4, :cond_c
|
||
|
|
||
|
.line 211
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
if-nez v0, :cond_9
|
||
|
|
||
|
.line 212
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->knownDrafts:Ljava/util/List;
|
||
|
|
||
|
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
:cond_5
|
||
|
:goto_4
|
||
|
invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_7
|
||
|
|
||
|
invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
check-cast v0, Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
.line 213
|
||
|
invoke-virtual {v0}, Lorg/java_websocket/drafts/Draft;->copyInstance()Lorg/java_websocket/drafts/Draft;
|
||
|
:try_end_3
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidHandshakeException; {:try_start_3 .. :try_end_3} :catch_6
|
||
|
.catch Lorg/java_websocket/exceptions/IncompleteHandshakeException; {:try_start_3 .. :try_end_3} :catch_1
|
||
|
|
||
|
move-result-object v5
|
||
|
|
||
|
.line 215
|
||
|
:try_start_4
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
invoke-virtual {v5, v0}, Lorg/java_websocket/drafts/Draft;->setParseMode(Lorg/java_websocket/WebSocket$Role;)V
|
||
|
|
||
|
.line 216
|
||
|
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->reset()Ljava/nio/Buffer;
|
||
|
|
||
|
.line 217
|
||
|
invoke-virtual {v5, v1}, Lorg/java_websocket/drafts/Draft;->translateHandshake(Ljava/nio/ByteBuffer;)Lorg/java_websocket/handshake/Handshakedata;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
.line 218
|
||
|
instance-of v6, v0, Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
if-nez v6, :cond_6
|
||
|
|
||
|
.line 219
|
||
|
const/16 v0, 0x3ea
|
||
|
|
||
|
const-string v5, "wrong http function"
|
||
|
|
||
|
const/4 v6, 0x0
|
||
|
|
||
|
invoke-virtual {p0, v0, v5, v6}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
move v0, v2
|
||
|
|
||
|
.line 220
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 222
|
||
|
:cond_6
|
||
|
check-cast v0, Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
.line 223
|
||
|
invoke-virtual {v5, v0}, Lorg/java_websocket/drafts/Draft;->acceptHandshakeAsServer(Lorg/java_websocket/handshake/ClientHandshake;)Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
|
||
|
move-result-object v6
|
||
|
|
||
|
.line 224
|
||
|
sget-object v7, Lorg/java_websocket/drafts/Draft$HandshakeState;->MATCHED:Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
|
||
|
if-ne v6, v7, :cond_5
|
||
|
|
||
|
.line 225
|
||
|
invoke-interface {v0}, Lorg/java_websocket/handshake/ClientHandshake;->getResourceDescriptor()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v6
|
||
|
|
||
|
iput-object v6, p0, Lorg/java_websocket/WebSocketImpl;->resourceDescriptor:Ljava/lang/String;
|
||
|
:try_end_4
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidHandshakeException; {:try_start_4 .. :try_end_4} :catch_7
|
||
|
.catch Lorg/java_websocket/exceptions/IncompleteHandshakeException; {:try_start_4 .. :try_end_4} :catch_1
|
||
|
|
||
|
.line 228
|
||
|
:try_start_5
|
||
|
iget-object v6, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v6, p0, v5, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketHandshakeReceivedAsServer(Lorg/java_websocket/WebSocket;Lorg/java_websocket/drafts/Draft;Lorg/java_websocket/handshake/ClientHandshake;)Lorg/java_websocket/handshake/ServerHandshakeBuilder;
|
||
|
:try_end_5
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_5 .. :try_end_5} :catch_2
|
||
|
.catch Ljava/lang/RuntimeException; {:try_start_5 .. :try_end_5} :catch_3
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidHandshakeException; {:try_start_5 .. :try_end_5} :catch_7
|
||
|
.catch Lorg/java_websocket/exceptions/IncompleteHandshakeException; {:try_start_5 .. :try_end_5} :catch_1
|
||
|
|
||
|
move-result-object v6
|
||
|
|
||
|
.line 237
|
||
|
:try_start_6
|
||
|
invoke-virtual {v5, v0, v6}, Lorg/java_websocket/drafts/Draft;->postProcessHandshakeResponseAsServer(Lorg/java_websocket/handshake/ClientHandshake;Lorg/java_websocket/handshake/ServerHandshakeBuilder;)Lorg/java_websocket/handshake/HandshakeBuilder;
|
||
|
|
||
|
move-result-object v6
|
||
|
|
||
|
iget-object v7, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
invoke-virtual {v5, v6, v7}, Lorg/java_websocket/drafts/Draft;->createHandshake(Lorg/java_websocket/handshake/Handshakedata;Lorg/java_websocket/WebSocket$Role;)Ljava/util/List;
|
||
|
|
||
|
move-result-object v6
|
||
|
|
||
|
invoke-direct {p0, v6}, Lorg/java_websocket/WebSocketImpl;->write(Ljava/util/List;)V
|
||
|
|
||
|
.line 238
|
||
|
iput-object v5, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
.line 239
|
||
|
invoke-direct {p0, v0}, Lorg/java_websocket/WebSocketImpl;->open(Lorg/java_websocket/handshake/Handshakedata;)V
|
||
|
|
||
|
move v0, v3
|
||
|
|
||
|
.line 240
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 229
|
||
|
:catch_2
|
||
|
move-exception v0
|
||
|
|
||
|
.line 230
|
||
|
invoke-virtual {v0}, Lorg/java_websocket/exceptions/InvalidDataException;->getCloseCode()I
|
||
|
|
||
|
move-result v5
|
||
|
|
||
|
invoke-virtual {v0}, Lorg/java_websocket/exceptions/InvalidDataException;->getMessage()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const/4 v6, 0x0
|
||
|
|
||
|
invoke-virtual {p0, v5, v0, v6}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
move v0, v2
|
||
|
|
||
|
.line 231
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 232
|
||
|
:catch_3
|
||
|
move-exception v0
|
||
|
|
||
|
.line 233
|
||
|
iget-object v5, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v5, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
|
||
|
.line 234
|
||
|
const/4 v5, -0x1
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/RuntimeException;->getMessage()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const/4 v6, 0x0
|
||
|
|
||
|
invoke-virtual {p0, v5, v0, v6}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
:try_end_6
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidHandshakeException; {:try_start_6 .. :try_end_6} :catch_7
|
||
|
.catch Lorg/java_websocket/exceptions/IncompleteHandshakeException; {:try_start_6 .. :try_end_6} :catch_1
|
||
|
|
||
|
move v0, v2
|
||
|
|
||
|
.line 235
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 246
|
||
|
:cond_7
|
||
|
:try_start_7
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
if-nez v0, :cond_8
|
||
|
|
||
|
.line 247
|
||
|
const/16 v0, 0x3ea
|
||
|
|
||
|
const-string v3, "no draft matches"
|
||
|
|
||
|
invoke-virtual {p0, v0, v3}, Lorg/java_websocket/WebSocketImpl;->close(ILjava/lang/String;)V
|
||
|
|
||
|
:cond_8
|
||
|
move v0, v2
|
||
|
|
||
|
.line 249
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 252
|
||
|
:cond_9
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v0, v1}, Lorg/java_websocket/drafts/Draft;->translateHandshake(Ljava/nio/ByteBuffer;)Lorg/java_websocket/handshake/Handshakedata;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
.line 253
|
||
|
instance-of v4, v0, Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
if-nez v4, :cond_a
|
||
|
|
||
|
.line 254
|
||
|
const/16 v0, 0x3ea
|
||
|
|
||
|
const-string v3, "wrong http function"
|
||
|
|
||
|
const/4 v4, 0x0
|
||
|
|
||
|
invoke-virtual {p0, v0, v3, v4}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
move v0, v2
|
||
|
|
||
|
.line 255
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 257
|
||
|
:cond_a
|
||
|
check-cast v0, Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
.line 258
|
||
|
iget-object v4, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v4, v0}, Lorg/java_websocket/drafts/Draft;->acceptHandshakeAsServer(Lorg/java_websocket/handshake/ClientHandshake;)Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
.line 260
|
||
|
sget-object v5, Lorg/java_websocket/drafts/Draft$HandshakeState;->MATCHED:Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
|
||
|
if-ne v4, v5, :cond_b
|
||
|
|
||
|
.line 261
|
||
|
invoke-direct {p0, v0}, Lorg/java_websocket/WebSocketImpl;->open(Lorg/java_websocket/handshake/Handshakedata;)V
|
||
|
|
||
|
move v0, v3
|
||
|
|
||
|
.line 262
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 264
|
||
|
:cond_b
|
||
|
const/16 v0, 0x3ea
|
||
|
|
||
|
const-string v3, "the handshake did finaly not match"
|
||
|
|
||
|
invoke-virtual {p0, v0, v3}, Lorg/java_websocket/WebSocketImpl;->close(ILjava/lang/String;)V
|
||
|
|
||
|
move v0, v2
|
||
|
|
||
|
.line 266
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 268
|
||
|
:cond_c
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
sget-object v4, Lorg/java_websocket/WebSocket$Role;->CLIENT:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
if-ne v0, v4, :cond_3
|
||
|
|
||
|
.line 269
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
iget-object v4, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
invoke-virtual {v0, v4}, Lorg/java_websocket/drafts/Draft;->setParseMode(Lorg/java_websocket/WebSocket$Role;)V
|
||
|
|
||
|
.line 270
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v0, v1}, Lorg/java_websocket/drafts/Draft;->translateHandshake(Ljava/nio/ByteBuffer;)Lorg/java_websocket/handshake/Handshakedata;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
.line 271
|
||
|
instance-of v4, v0, Lorg/java_websocket/handshake/ServerHandshake;
|
||
|
|
||
|
if-nez v4, :cond_d
|
||
|
|
||
|
.line 272
|
||
|
const/16 v0, 0x3ea
|
||
|
|
||
|
const-string v3, "wrong http function"
|
||
|
|
||
|
const/4 v4, 0x0
|
||
|
|
||
|
invoke-virtual {p0, v0, v3, v4}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
move v0, v2
|
||
|
|
||
|
.line 273
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 275
|
||
|
:cond_d
|
||
|
check-cast v0, Lorg/java_websocket/handshake/ServerHandshake;
|
||
|
|
||
|
.line 276
|
||
|
iget-object v4, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
iget-object v5, p0, Lorg/java_websocket/WebSocketImpl;->handshakerequest:Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
invoke-virtual {v4, v5, v0}, Lorg/java_websocket/drafts/Draft;->acceptHandshakeAsClient(Lorg/java_websocket/handshake/ClientHandshake;Lorg/java_websocket/handshake/ServerHandshake;)Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
.line 277
|
||
|
sget-object v5, Lorg/java_websocket/drafts/Draft$HandshakeState;->MATCHED:Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
:try_end_7
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidHandshakeException; {:try_start_7 .. :try_end_7} :catch_6
|
||
|
.catch Lorg/java_websocket/exceptions/IncompleteHandshakeException; {:try_start_7 .. :try_end_7} :catch_1
|
||
|
|
||
|
if-ne v4, v5, :cond_e
|
||
|
|
||
|
.line 279
|
||
|
:try_start_8
|
||
|
iget-object v4, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
iget-object v5, p0, Lorg/java_websocket/WebSocketImpl;->handshakerequest:Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
invoke-interface {v4, p0, v5, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketHandshakeReceivedAsClient(Lorg/java_websocket/WebSocket;Lorg/java_websocket/handshake/ClientHandshake;Lorg/java_websocket/handshake/ServerHandshake;)V
|
||
|
:try_end_8
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_8 .. :try_end_8} :catch_4
|
||
|
.catch Ljava/lang/RuntimeException; {:try_start_8 .. :try_end_8} :catch_5
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidHandshakeException; {:try_start_8 .. :try_end_8} :catch_6
|
||
|
.catch Lorg/java_websocket/exceptions/IncompleteHandshakeException; {:try_start_8 .. :try_end_8} :catch_1
|
||
|
|
||
|
.line 288
|
||
|
:try_start_9
|
||
|
invoke-direct {p0, v0}, Lorg/java_websocket/WebSocketImpl;->open(Lorg/java_websocket/handshake/Handshakedata;)V
|
||
|
|
||
|
move v0, v3
|
||
|
|
||
|
.line 289
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 280
|
||
|
:catch_4
|
||
|
move-exception v0
|
||
|
|
||
|
.line 281
|
||
|
invoke-virtual {v0}, Lorg/java_websocket/exceptions/InvalidDataException;->getCloseCode()I
|
||
|
|
||
|
move-result v3
|
||
|
|
||
|
invoke-virtual {v0}, Lorg/java_websocket/exceptions/InvalidDataException;->getMessage()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const/4 v4, 0x0
|
||
|
|
||
|
invoke-virtual {p0, v3, v0, v4}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
move v0, v2
|
||
|
|
||
|
.line 282
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 283
|
||
|
:catch_5
|
||
|
move-exception v0
|
||
|
|
||
|
.line 284
|
||
|
iget-object v3, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v3, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
|
||
|
.line 285
|
||
|
const/4 v3, -0x1
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/RuntimeException;->getMessage()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const/4 v4, 0x0
|
||
|
|
||
|
invoke-virtual {p0, v3, v0, v4}, Lorg/java_websocket/WebSocketImpl;->flushAndClose(ILjava/lang/String;Z)V
|
||
|
|
||
|
move v0, v2
|
||
|
|
||
|
.line 286
|
||
|
goto/16 :goto_2
|
||
|
|
||
|
.line 291
|
||
|
:cond_e
|
||
|
const/16 v0, 0x3ea
|
||
|
|
||
|
new-instance v3, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v4, "draft "
|
||
|
|
||
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
iget-object v4, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
const-string v4, " refuses handshake"
|
||
|
|
||
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
invoke-virtual {p0, v0, v3}, Lorg/java_websocket/WebSocketImpl;->close(ILjava/lang/String;)V
|
||
|
:try_end_9
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidHandshakeException; {:try_start_9 .. :try_end_9} :catch_6
|
||
|
.catch Lorg/java_websocket/exceptions/IncompleteHandshakeException; {:try_start_9 .. :try_end_9} :catch_1
|
||
|
|
||
|
goto/16 :goto_3
|
||
|
|
||
|
.line 294
|
||
|
:catch_6
|
||
|
move-exception v0
|
||
|
|
||
|
.line 295
|
||
|
:try_start_a
|
||
|
invoke-virtual {p0, v0}, Lorg/java_websocket/WebSocketImpl;->close(Lorg/java_websocket/exceptions/InvalidDataException;)V
|
||
|
:try_end_a
|
||
|
.catch Lorg/java_websocket/exceptions/IncompleteHandshakeException; {:try_start_a .. :try_end_a} :catch_1
|
||
|
|
||
|
goto/16 :goto_3
|
||
|
|
||
|
.line 304
|
||
|
:cond_f
|
||
|
sget-boolean v4, Lorg/java_websocket/WebSocketImpl;->$assertionsDisabled:Z
|
||
|
|
||
|
if-nez v4, :cond_2
|
||
|
|
||
|
invoke-virtual {v3}, Lorg/java_websocket/exceptions/IncompleteHandshakeException;->getPreferedSize()I
|
||
|
|
||
|
move-result v3
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->remaining()I
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
if-ge v3, v1, :cond_2
|
||
|
|
||
|
new-instance v0, Ljava/lang/AssertionError;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 311
|
||
|
:cond_10
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->limit()I
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;
|
||
|
|
||
|
.line 312
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->capacity()I
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
|
||
|
|
||
|
goto/16 :goto_3
|
||
|
|
||
|
.line 242
|
||
|
:catch_7
|
||
|
move-exception v0
|
||
|
|
||
|
goto/16 :goto_4
|
||
|
.end method
|
||
|
|
||
|
.method private isFlashEdgeCase(Ljava/nio/ByteBuffer;)Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
.line 596
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->mark()Ljava/nio/Buffer;
|
||
|
|
||
|
.line 597
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->limit()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/drafts/Draft;->FLASH_POLICY_REQUEST:[B
|
||
|
|
||
|
array-length v1, v1
|
||
|
|
||
|
if-le v0, v1, :cond_0
|
||
|
|
||
|
.line 598
|
||
|
sget-object v0, Lorg/java_websocket/drafts/Draft$HandshakeState;->NOT_MATCHED:Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
|
||
|
.line 609
|
||
|
:goto_0
|
||
|
return-object v0
|
||
|
|
||
|
.line 599
|
||
|
:cond_0
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->limit()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/drafts/Draft;->FLASH_POLICY_REQUEST:[B
|
||
|
|
||
|
array-length v1, v1
|
||
|
|
||
|
if-ge v0, v1, :cond_1
|
||
|
|
||
|
.line 600
|
||
|
new-instance v0, Lorg/java_websocket/exceptions/IncompleteHandshakeException;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/drafts/Draft;->FLASH_POLICY_REQUEST:[B
|
||
|
|
||
|
array-length v1, v1
|
||
|
|
||
|
invoke-direct {v0, v1}, Lorg/java_websocket/exceptions/IncompleteHandshakeException;-><init>(I)V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 603
|
||
|
:cond_1
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
:goto_1
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->hasRemaining()Z
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
if-eqz v1, :cond_3
|
||
|
|
||
|
.line 604
|
||
|
sget-object v1, Lorg/java_websocket/drafts/Draft;->FLASH_POLICY_REQUEST:[B
|
||
|
|
||
|
aget-byte v1, v1, v0
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->get()B
|
||
|
|
||
|
move-result v2
|
||
|
|
||
|
if-eq v1, v2, :cond_2
|
||
|
|
||
|
.line 605
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->reset()Ljava/nio/Buffer;
|
||
|
|
||
|
.line 606
|
||
|
sget-object v0, Lorg/java_websocket/drafts/Draft$HandshakeState;->NOT_MATCHED:Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 603
|
||
|
:cond_2
|
||
|
add-int/lit8 v0, v0, 0x1
|
||
|
|
||
|
goto :goto_1
|
||
|
|
||
|
.line 609
|
||
|
:cond_3
|
||
|
sget-object v0, Lorg/java_websocket/drafts/Draft$HandshakeState;->MATCHED:Lorg/java_websocket/drafts/Draft$HandshakeState;
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method private open(Lorg/java_websocket/handshake/Handshakedata;)V
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
.line 659
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->DEBUG:Z
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
.line 660
|
||
|
sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;
|
||
|
|
||
|
new-instance v1, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v2, "open using draft: "
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
iget-object v2, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
|
||
|
|
||
|
.line 661
|
||
|
:cond_0
|
||
|
sget-object v0, Lorg/java_websocket/WebSocket$READYSTATE;->OPEN:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
.line 663
|
||
|
:try_start_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v0, p0, p1}, Lorg/java_websocket/WebSocketListener;->onWebsocketOpen(Lorg/java_websocket/WebSocket;Lorg/java_websocket/handshake/Handshakedata;)V
|
||
|
:try_end_0
|
||
|
.catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0
|
||
|
|
||
|
.line 667
|
||
|
:goto_0
|
||
|
return-void
|
||
|
|
||
|
.line 664
|
||
|
:catch_0
|
||
|
move-exception v0
|
||
|
|
||
|
.line 665
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method private send(Ljava/util/Collection;)V
|
||
|
.locals 2
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"(",
|
||
|
"Ljava/util/Collection",
|
||
|
"<",
|
||
|
"Lorg/java_websocket/framing/Framedata;",
|
||
|
">;)V"
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
.prologue
|
||
|
.line 571
|
||
|
invoke-virtual {p0}, Lorg/java_websocket/WebSocketImpl;->isOpen()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
.line 572
|
||
|
new-instance v0, Lorg/java_websocket/exceptions/WebsocketNotConnectedException;
|
||
|
|
||
|
invoke-direct {v0}, Lorg/java_websocket/exceptions/WebsocketNotConnectedException;-><init>()V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 573
|
||
|
:cond_0
|
||
|
invoke-interface {p1}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
:goto_0
|
||
|
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
check-cast v0, Lorg/java_websocket/framing/Framedata;
|
||
|
|
||
|
.line 574
|
||
|
invoke-virtual {p0, v0}, Lorg/java_websocket/WebSocketImpl;->sendFrame(Lorg/java_websocket/framing/Framedata;)V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 576
|
||
|
:cond_1
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method private write(Ljava/nio/ByteBuffer;)V
|
||
|
.locals 4
|
||
|
|
||
|
.prologue
|
||
|
.line 638
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->DEBUG:Z
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
.line 639
|
||
|
sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
|
||
|
|
||
|
new-instance v0, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v2, "write("
|
||
|
|
||
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I
|
||
|
|
||
|
move-result v2
|
||
|
|
||
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v2, "): {"
|
||
|
|
||
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
const/16 v3, 0x3e8
|
||
|
|
||
|
if-le v0, v3, :cond_1
|
||
|
|
||
|
const-string v0, "too big to display"
|
||
|
|
||
|
:goto_0
|
||
|
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v2, "}"
|
||
|
|
||
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v1, v0}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
|
||
|
|
||
|
.line 641
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->outQueue:Ljava/util/concurrent/BlockingQueue;
|
||
|
|
||
|
invoke-interface {v0, p1}, Ljava/util/concurrent/BlockingQueue;->add(Ljava/lang/Object;)Z
|
||
|
|
||
|
.line 649
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v0, p0}, Lorg/java_websocket/WebSocketListener;->onWriteDemand(Lorg/java_websocket/WebSocket;)V
|
||
|
|
||
|
.line 650
|
||
|
return-void
|
||
|
|
||
|
.line 639
|
||
|
:cond_1
|
||
|
new-instance v0, Ljava/lang/String;
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->array()[B
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
invoke-direct {v0, v3}, Ljava/lang/String;-><init>([B)V
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method private write(Ljava/util/List;)V
|
||
|
.locals 2
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"(",
|
||
|
"Ljava/util/List",
|
||
|
"<",
|
||
|
"Ljava/nio/ByteBuffer;",
|
||
|
">;)V"
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
.prologue
|
||
|
.line 653
|
||
|
invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
:goto_0
|
||
|
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
check-cast v0, Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.line 654
|
||
|
invoke-direct {p0, v0}, Lorg/java_websocket/WebSocketImpl;->write(Ljava/nio/ByteBuffer;)V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 656
|
||
|
:cond_0
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
|
||
|
# virtual methods
|
||
|
.method public close()V
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 728
|
||
|
const/16 v0, 0x3e8
|
||
|
|
||
|
invoke-virtual {p0, v0}, Lorg/java_websocket/WebSocketImpl;->close(I)V
|
||
|
|
||
|
.line 729
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public close(I)V
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 532
|
||
|
const-string v0, ""
|
||
|
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
invoke-direct {p0, p1, v0, v1}, Lorg/java_websocket/WebSocketImpl;->close(ILjava/lang/String;Z)V
|
||
|
|
||
|
.line 533
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public close(ILjava/lang/String;)V
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 438
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
invoke-direct {p0, p1, p2, v0}, Lorg/java_websocket/WebSocketImpl;->close(ILjava/lang/String;Z)V
|
||
|
|
||
|
.line 439
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public close(Lorg/java_websocket/exceptions/InvalidDataException;)V
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
.line 536
|
||
|
invoke-virtual {p1}, Lorg/java_websocket/exceptions/InvalidDataException;->getCloseCode()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
invoke-virtual {p1}, Lorg/java_websocket/exceptions/InvalidDataException;->getMessage()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
invoke-direct {p0, v0, v1, v2}, Lorg/java_websocket/WebSocketImpl;->close(ILjava/lang/String;Z)V
|
||
|
|
||
|
.line 537
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public closeConnection()V
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
.line 482
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->closedremotely:Ljava/lang/Boolean;
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
.line 483
|
||
|
new-instance v0, Ljava/lang/IllegalStateException;
|
||
|
|
||
|
const-string v1, "this method must be used in conjuction with flushAndClose"
|
||
|
|
||
|
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 485
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->closecode:Ljava/lang/Integer;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->closemessage:Ljava/lang/String;
|
||
|
|
||
|
iget-object v2, p0, Lorg/java_websocket/WebSocketImpl;->closedremotely:Ljava/lang/Boolean;
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/lang/Boolean;->booleanValue()Z
|
||
|
|
||
|
move-result v2
|
||
|
|
||
|
invoke-virtual {p0, v0, v1, v2}, Lorg/java_websocket/WebSocketImpl;->closeConnection(ILjava/lang/String;Z)V
|
||
|
|
||
|
.line 486
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public closeConnection(ILjava/lang/String;)V
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 489
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
invoke-virtual {p0, p1, p2, v0}, Lorg/java_websocket/WebSocketImpl;->closeConnection(ILjava/lang/String;Z)V
|
||
|
|
||
|
.line 490
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method protected declared-synchronized closeConnection(ILjava/lang/String;Z)V
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 449
|
||
|
monitor-enter p0
|
||
|
|
||
|
:try_start_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->CLOSED:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
if-ne v0, v1, :cond_0
|
||
|
|
||
|
.line 475
|
||
|
:goto_0
|
||
|
monitor-exit p0
|
||
|
|
||
|
return-void
|
||
|
|
||
|
.line 453
|
||
|
:cond_0
|
||
|
:try_start_1
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->key:Ljava/nio/channels/SelectionKey;
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
.line 455
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->key:Ljava/nio/channels/SelectionKey;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/nio/channels/SelectionKey;->cancel()V
|
||
|
|
||
|
.line 457
|
||
|
:cond_1
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->channel:Ljava/nio/channels/ByteChannel;
|
||
|
:try_end_1
|
||
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
||
|
|
||
|
if-eqz v0, :cond_2
|
||
|
|
||
|
.line 459
|
||
|
:try_start_2
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->channel:Ljava/nio/channels/ByteChannel;
|
||
|
|
||
|
invoke-interface {v0}, Ljava/nio/channels/ByteChannel;->close()V
|
||
|
:try_end_2
|
||
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
|
||
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
||
|
|
||
|
.line 465
|
||
|
:cond_2
|
||
|
:goto_1
|
||
|
:try_start_3
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v0, p0, p1, p2, p3}, Lorg/java_websocket/WebSocketListener;->onWebsocketClose(Lorg/java_websocket/WebSocket;ILjava/lang/String;Z)V
|
||
|
:try_end_3
|
||
|
.catch Ljava/lang/RuntimeException; {:try_start_3 .. :try_end_3} :catch_1
|
||
|
.catchall {:try_start_3 .. :try_end_3} :catchall_0
|
||
|
|
||
|
.line 469
|
||
|
:goto_2
|
||
|
:try_start_4
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
if-eqz v0, :cond_3
|
||
|
|
||
|
.line 470
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v0}, Lorg/java_websocket/drafts/Draft;->reset()V
|
||
|
|
||
|
.line 471
|
||
|
:cond_3
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->handshakerequest:Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
.line 473
|
||
|
sget-object v0, Lorg/java_websocket/WebSocket$READYSTATE;->CLOSED:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
.line 474
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->outQueue:Ljava/util/concurrent/BlockingQueue;
|
||
|
|
||
|
invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->clear()V
|
||
|
:try_end_4
|
||
|
.catchall {:try_start_4 .. :try_end_4} :catchall_0
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 449
|
||
|
:catchall_0
|
||
|
move-exception v0
|
||
|
|
||
|
monitor-exit p0
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 460
|
||
|
:catch_0
|
||
|
move-exception v0
|
||
|
|
||
|
.line 461
|
||
|
:try_start_5
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
|
||
|
goto :goto_1
|
||
|
|
||
|
.line 466
|
||
|
:catch_1
|
||
|
move-exception v0
|
||
|
|
||
|
.line 467
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
:try_end_5
|
||
|
.catchall {:try_start_5 .. :try_end_5} :catchall_0
|
||
|
|
||
|
goto :goto_2
|
||
|
.end method
|
||
|
|
||
|
.method protected closeConnection(IZ)V
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 478
|
||
|
const-string v0, ""
|
||
|
|
||
|
invoke-virtual {p0, p1, v0, p2}, Lorg/java_websocket/WebSocketImpl;->closeConnection(ILjava/lang/String;Z)V
|
||
|
|
||
|
.line 479
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public decode(Ljava/nio/ByteBuffer;)V
|
||
|
.locals 6
|
||
|
|
||
|
.prologue
|
||
|
.line 151
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->$assertionsDisabled:Z
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->hasRemaining()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
new-instance v0, Ljava/lang/AssertionError;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 153
|
||
|
:cond_0
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->DEBUG:Z
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
.line 154
|
||
|
sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
|
||
|
|
||
|
new-instance v0, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v2, "process("
|
||
|
|
||
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I
|
||
|
|
||
|
move-result v2
|
||
|
|
||
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v2, "): {"
|
||
|
|
||
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
const/16 v3, 0x3e8
|
||
|
|
||
|
if-le v0, v3, :cond_3
|
||
|
|
||
|
const-string v0, "too big to display"
|
||
|
|
||
|
:goto_0
|
||
|
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v2, "}"
|
||
|
|
||
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v1, v0}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
|
||
|
|
||
|
.line 156
|
||
|
:cond_1
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->NOT_YET_CONNECTED:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-eq v0, v1, :cond_4
|
||
|
|
||
|
.line 157
|
||
|
invoke-direct {p0, p1}, Lorg/java_websocket/WebSocketImpl;->decodeFrames(Ljava/nio/ByteBuffer;)V
|
||
|
|
||
|
.line 170
|
||
|
:cond_2
|
||
|
:goto_1
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->$assertionsDisabled:Z
|
||
|
|
||
|
if-nez v0, :cond_7
|
||
|
|
||
|
invoke-virtual {p0}, Lorg/java_websocket/WebSocketImpl;->isClosing()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-nez v0, :cond_7
|
||
|
|
||
|
invoke-virtual {p0}, Lorg/java_websocket/WebSocketImpl;->isFlushAndClose()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-nez v0, :cond_7
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->hasRemaining()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_7
|
||
|
|
||
|
new-instance v0, Ljava/lang/AssertionError;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 154
|
||
|
:cond_3
|
||
|
new-instance v0, Ljava/lang/String;
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->array()[B
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->position()I
|
||
|
|
||
|
move-result v4
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I
|
||
|
|
||
|
move-result v5
|
||
|
|
||
|
invoke-direct {v0, v3, v4, v5}, Ljava/lang/String;-><init>([BII)V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 160
|
||
|
:cond_4
|
||
|
invoke-direct {p0, p1}, Lorg/java_websocket/WebSocketImpl;->decodeHandshake(Ljava/nio/ByteBuffer;)Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_2
|
||
|
|
||
|
.line 161
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->$assertionsDisabled:Z
|
||
|
|
||
|
if-nez v0, :cond_5
|
||
|
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->hasRemaining()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->hasRemaining()Z
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
if-ne v0, v1, :cond_5
|
||
|
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->hasRemaining()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_5
|
||
|
|
||
|
new-instance v0, Ljava/lang/AssertionError;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 163
|
||
|
:cond_5
|
||
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->hasRemaining()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_6
|
||
|
|
||
|
.line 164
|
||
|
invoke-direct {p0, p1}, Lorg/java_websocket/WebSocketImpl;->decodeFrames(Ljava/nio/ByteBuffer;)V
|
||
|
|
||
|
goto :goto_1
|
||
|
|
||
|
.line 165
|
||
|
:cond_6
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->hasRemaining()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_2
|
||
|
|
||
|
.line 166
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->tmpHandshakeBytes:Ljava/nio/ByteBuffer;
|
||
|
|
||
|
invoke-direct {p0, v0}, Lorg/java_websocket/WebSocketImpl;->decodeFrames(Ljava/nio/ByteBuffer;)V
|
||
|
|
||
|
goto :goto_1
|
||
|
|
||
|
.line 171
|
||
|
:cond_7
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public eot()V
|
||
|
.locals 5
|
||
|
|
||
|
.prologue
|
||
|
const/16 v4, 0x3ee
|
||
|
|
||
|
const/16 v3, 0x3e8
|
||
|
|
||
|
const/4 v2, 0x1
|
||
|
|
||
|
.line 514
|
||
|
invoke-virtual {p0}, Lorg/java_websocket/WebSocketImpl;->getReadyState()Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->NOT_YET_CONNECTED:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-ne v0, v1, :cond_0
|
||
|
|
||
|
.line 515
|
||
|
const/4 v0, -0x1
|
||
|
|
||
|
invoke-virtual {p0, v0, v2}, Lorg/java_websocket/WebSocketImpl;->closeConnection(IZ)V
|
||
|
|
||
|
.line 528
|
||
|
:goto_0
|
||
|
return-void
|
||
|
|
||
|
.line 516
|
||
|
:cond_0
|
||
|
iget-boolean v0, p0, Lorg/java_websocket/WebSocketImpl;->flushandclosestate:Z
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
.line 517
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->closecode:Ljava/lang/Integer;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->closemessage:Ljava/lang/String;
|
||
|
|
||
|
iget-object v2, p0, Lorg/java_websocket/WebSocketImpl;->closedremotely:Ljava/lang/Boolean;
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/lang/Boolean;->booleanValue()Z
|
||
|
|
||
|
move-result v2
|
||
|
|
||
|
invoke-virtual {p0, v0, v1, v2}, Lorg/java_websocket/WebSocketImpl;->closeConnection(ILjava/lang/String;Z)V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 518
|
||
|
:cond_1
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v0}, Lorg/java_websocket/drafts/Draft;->getCloseHandshakeType()Lorg/java_websocket/drafts/Draft$CloseHandshakeType;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/drafts/Draft$CloseHandshakeType;->NONE:Lorg/java_websocket/drafts/Draft$CloseHandshakeType;
|
||
|
|
||
|
if-ne v0, v1, :cond_2
|
||
|
|
||
|
.line 519
|
||
|
invoke-virtual {p0, v3, v2}, Lorg/java_websocket/WebSocketImpl;->closeConnection(IZ)V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 520
|
||
|
:cond_2
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v0}, Lorg/java_websocket/drafts/Draft;->getCloseHandshakeType()Lorg/java_websocket/drafts/Draft$CloseHandshakeType;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/drafts/Draft$CloseHandshakeType;->ONEWAY:Lorg/java_websocket/drafts/Draft$CloseHandshakeType;
|
||
|
|
||
|
if-ne v0, v1, :cond_4
|
||
|
|
||
|
.line 521
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$Role;->SERVER:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
if-ne v0, v1, :cond_3
|
||
|
|
||
|
.line 522
|
||
|
invoke-virtual {p0, v4, v2}, Lorg/java_websocket/WebSocketImpl;->closeConnection(IZ)V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 524
|
||
|
:cond_3
|
||
|
invoke-virtual {p0, v3, v2}, Lorg/java_websocket/WebSocketImpl;->closeConnection(IZ)V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 526
|
||
|
:cond_4
|
||
|
invoke-virtual {p0, v4, v2}, Lorg/java_websocket/WebSocketImpl;->closeConnection(IZ)V
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method protected declared-synchronized flushAndClose(ILjava/lang/String;Z)V
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 493
|
||
|
monitor-enter p0
|
||
|
|
||
|
:try_start_0
|
||
|
iget-boolean v0, p0, Lorg/java_websocket/WebSocketImpl;->flushandclosestate:Z
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
.line 511
|
||
|
:goto_0
|
||
|
monitor-exit p0
|
||
|
|
||
|
return-void
|
||
|
|
||
|
.line 496
|
||
|
:cond_0
|
||
|
:try_start_1
|
||
|
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->closecode:Ljava/lang/Integer;
|
||
|
|
||
|
.line 497
|
||
|
iput-object p2, p0, Lorg/java_websocket/WebSocketImpl;->closemessage:Ljava/lang/String;
|
||
|
|
||
|
.line 498
|
||
|
invoke-static {p3}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->closedremotely:Ljava/lang/Boolean;
|
||
|
|
||
|
.line 500
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
iput-boolean v0, p0, Lorg/java_websocket/WebSocketImpl;->flushandclosestate:Z
|
||
|
|
||
|
.line 502
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v0, p0}, Lorg/java_websocket/WebSocketListener;->onWriteDemand(Lorg/java_websocket/WebSocket;)V
|
||
|
:try_end_1
|
||
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
||
|
|
||
|
.line 504
|
||
|
:try_start_2
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v0, p0, p1, p2, p3}, Lorg/java_websocket/WebSocketListener;->onWebsocketClosing(Lorg/java_websocket/WebSocket;ILjava/lang/String;Z)V
|
||
|
:try_end_2
|
||
|
.catch Ljava/lang/RuntimeException; {:try_start_2 .. :try_end_2} :catch_0
|
||
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
||
|
|
||
|
.line 508
|
||
|
:goto_1
|
||
|
:try_start_3
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
.line 509
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v0}, Lorg/java_websocket/drafts/Draft;->reset()V
|
||
|
|
||
|
.line 510
|
||
|
:cond_1
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->handshakerequest:Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
:try_end_3
|
||
|
.catchall {:try_start_3 .. :try_end_3} :catchall_0
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 493
|
||
|
:catchall_0
|
||
|
move-exception v0
|
||
|
|
||
|
monitor-exit p0
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 505
|
||
|
:catch_0
|
||
|
move-exception v0
|
||
|
|
||
|
.line 506
|
||
|
:try_start_4
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
:try_end_4
|
||
|
.catchall {:try_start_4 .. :try_end_4} :catchall_0
|
||
|
|
||
|
goto :goto_1
|
||
|
.end method
|
||
|
|
||
|
.method public getDraft()Lorg/java_websocket/drafts/Draft;
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 723
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method public getLocalSocketAddress()Ljava/net/InetSocketAddress;
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 718
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v0, p0}, Lorg/java_websocket/WebSocketListener;->getLocalSocketAddress(Lorg/java_websocket/WebSocket;)Ljava/net/InetSocketAddress;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method public getReadyState()Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 698
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method public getRemoteSocketAddress()Ljava/net/InetSocketAddress;
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 713
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v0, p0}, Lorg/java_websocket/WebSocketListener;->getRemoteSocketAddress(Lorg/java_websocket/WebSocket;)Ljava/net/InetSocketAddress;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method public getResourceDescriptor()Ljava/lang/String;
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 733
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->resourceDescriptor:Ljava/lang/String;
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method public hasBufferedData()Z
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 592
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->outQueue:Ljava/util/concurrent/BlockingQueue;
|
||
|
|
||
|
invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->isEmpty()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
:goto_0
|
||
|
return v0
|
||
|
|
||
|
:cond_0
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method public hashCode()I
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 703
|
||
|
invoke-super {p0}, Ljava/lang/Object;->hashCode()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method public isClosed()Z
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 693
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->CLOSED:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-ne v0, v1, :cond_0
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
:goto_0
|
||
|
return v0
|
||
|
|
||
|
:cond_0
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method public isClosing()Z
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 683
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->CLOSING:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-ne v0, v1, :cond_0
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
:goto_0
|
||
|
return v0
|
||
|
|
||
|
:cond_0
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method public isConnecting()Z
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 671
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->$assertionsDisabled:Z
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
iget-boolean v0, p0, Lorg/java_websocket/WebSocketImpl;->flushandclosestate:Z
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->CONNECTING:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-ne v0, v1, :cond_1
|
||
|
|
||
|
.line 672
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->CONNECTING:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-ne v0, v1, :cond_2
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
:goto_0
|
||
|
return v0
|
||
|
|
||
|
.line 671
|
||
|
:cond_1
|
||
|
new-instance v0, Ljava/lang/AssertionError;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 672
|
||
|
:cond_2
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method public isFlushAndClose()Z
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 688
|
||
|
iget-boolean v0, p0, Lorg/java_websocket/WebSocketImpl;->flushandclosestate:Z
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method public isOpen()Z
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 677
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->$assertionsDisabled:Z
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->OPEN:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-ne v0, v1, :cond_0
|
||
|
|
||
|
iget-boolean v0, p0, Lorg/java_websocket/WebSocketImpl;->flushandclosestate:Z
|
||
|
|
||
|
if-nez v0, :cond_1
|
||
|
|
||
|
.line 678
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->OPEN:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-ne v0, v1, :cond_2
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
:goto_0
|
||
|
return v0
|
||
|
|
||
|
.line 677
|
||
|
:cond_1
|
||
|
new-instance v0, Ljava/lang/AssertionError;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 678
|
||
|
:cond_2
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method public send(Ljava/lang/String;)V
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
.line 547
|
||
|
if-nez p1, :cond_0
|
||
|
|
||
|
.line 548
|
||
|
new-instance v0, Ljava/lang/IllegalArgumentException;
|
||
|
|
||
|
const-string v1, "Cannot send \'null\' data to a WebSocketImpl."
|
||
|
|
||
|
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 549
|
||
|
:cond_0
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
sget-object v2, Lorg/java_websocket/WebSocket$Role;->CLIENT:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
if-ne v0, v2, :cond_1
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
:goto_0
|
||
|
invoke-virtual {v1, p1, v0}, Lorg/java_websocket/drafts/Draft;->createFrames(Ljava/lang/String;Z)Ljava/util/List;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-direct {p0, v0}, Lorg/java_websocket/WebSocketImpl;->send(Ljava/util/Collection;)V
|
||
|
|
||
|
.line 550
|
||
|
return-void
|
||
|
|
||
|
.line 549
|
||
|
:cond_1
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method public send(Ljava/nio/ByteBuffer;)V
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
.line 560
|
||
|
if-nez p1, :cond_0
|
||
|
|
||
|
.line 561
|
||
|
new-instance v0, Ljava/lang/IllegalArgumentException;
|
||
|
|
||
|
const-string v1, "Cannot send \'null\' data to a WebSocketImpl."
|
||
|
|
||
|
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 562
|
||
|
:cond_0
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
sget-object v2, Lorg/java_websocket/WebSocket$Role;->CLIENT:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
if-ne v0, v2, :cond_1
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
:goto_0
|
||
|
invoke-virtual {v1, p1, v0}, Lorg/java_websocket/drafts/Draft;->createFrames(Ljava/nio/ByteBuffer;Z)Ljava/util/List;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-direct {p0, v0}, Lorg/java_websocket/WebSocketImpl;->send(Ljava/util/Collection;)V
|
||
|
|
||
|
.line 563
|
||
|
return-void
|
||
|
|
||
|
.line 562
|
||
|
:cond_1
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method public send([B)V
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 567
|
||
|
invoke-static {p1}, Ljava/nio/ByteBuffer;->wrap([B)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {p0, v0}, Lorg/java_websocket/WebSocketImpl;->send(Ljava/nio/ByteBuffer;)V
|
||
|
|
||
|
.line 568
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public sendFragmentedFrame(Lorg/java_websocket/framing/Framedata$Opcode;Ljava/nio/ByteBuffer;Z)V
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 580
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v0, p1, p2, p3}, Lorg/java_websocket/drafts/Draft;->continuousFrame(Lorg/java_websocket/framing/Framedata$Opcode;Ljava/nio/ByteBuffer;Z)Ljava/util/List;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-direct {p0, v0}, Lorg/java_websocket/WebSocketImpl;->send(Ljava/util/Collection;)V
|
||
|
|
||
|
.line 581
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public sendFrame(Lorg/java_websocket/framing/Framedata;)V
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
.line 585
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->DEBUG:Z
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
.line 586
|
||
|
sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;
|
||
|
|
||
|
new-instance v1, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v2, "send frame: "
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
|
||
|
|
||
|
.line 587
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v0, p1}, Lorg/java_websocket/drafts/Draft;->createBinaryFrame(Lorg/java_websocket/framing/Framedata;)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-direct {p0, v0}, Lorg/java_websocket/WebSocketImpl;->write(Ljava/nio/ByteBuffer;)V
|
||
|
|
||
|
.line 588
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public startHandshake(Lorg/java_websocket/handshake/ClientHandshakeBuilder;)V
|
||
|
.locals 4
|
||
|
|
||
|
.prologue
|
||
|
.line 614
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->$assertionsDisabled:Z
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->readystate:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
sget-object v1, Lorg/java_websocket/WebSocket$READYSTATE;->CONNECTING:Lorg/java_websocket/WebSocket$READYSTATE;
|
||
|
|
||
|
if-ne v0, v1, :cond_0
|
||
|
|
||
|
new-instance v0, Ljava/lang/AssertionError;
|
||
|
|
||
|
const-string v1, "shall only be called once"
|
||
|
|
||
|
invoke-direct {v0, v1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 617
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
invoke-virtual {v0, p1}, Lorg/java_websocket/drafts/Draft;->postProcessHandshakeRequestAsClient(Lorg/java_websocket/handshake/ClientHandshakeBuilder;)Lorg/java_websocket/handshake/ClientHandshakeBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->handshakerequest:Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
.line 619
|
||
|
invoke-interface {p1}, Lorg/java_websocket/handshake/ClientHandshakeBuilder;->getResourceDescriptor()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iput-object v0, p0, Lorg/java_websocket/WebSocketImpl;->resourceDescriptor:Ljava/lang/String;
|
||
|
|
||
|
.line 620
|
||
|
sget-boolean v0, Lorg/java_websocket/WebSocketImpl;->$assertionsDisabled:Z
|
||
|
|
||
|
if-nez v0, :cond_1
|
||
|
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->resourceDescriptor:Ljava/lang/String;
|
||
|
|
||
|
if-nez v0, :cond_1
|
||
|
|
||
|
new-instance v0, Ljava/lang/AssertionError;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 624
|
||
|
:cond_1
|
||
|
:try_start_0
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->handshakerequest:Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
invoke-interface {v0, p0, v1}, Lorg/java_websocket/WebSocketListener;->onWebsocketHandshakeSentAsClient(Lorg/java_websocket/WebSocket;Lorg/java_websocket/handshake/ClientHandshake;)V
|
||
|
:try_end_0
|
||
|
.catch Lorg/java_websocket/exceptions/InvalidDataException; {:try_start_0 .. :try_end_0} :catch_0
|
||
|
.catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_1
|
||
|
|
||
|
.line 634
|
||
|
iget-object v0, p0, Lorg/java_websocket/WebSocketImpl;->draft:Lorg/java_websocket/drafts/Draft;
|
||
|
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->handshakerequest:Lorg/java_websocket/handshake/ClientHandshake;
|
||
|
|
||
|
iget-object v2, p0, Lorg/java_websocket/WebSocketImpl;->role:Lorg/java_websocket/WebSocket$Role;
|
||
|
|
||
|
invoke-virtual {v0, v1, v2}, Lorg/java_websocket/drafts/Draft;->createHandshake(Lorg/java_websocket/handshake/Handshakedata;Lorg/java_websocket/WebSocket$Role;)Ljava/util/List;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-direct {p0, v0}, Lorg/java_websocket/WebSocketImpl;->write(Ljava/util/List;)V
|
||
|
|
||
|
.line 635
|
||
|
return-void
|
||
|
|
||
|
.line 625
|
||
|
:catch_0
|
||
|
move-exception v0
|
||
|
|
||
|
.line 627
|
||
|
new-instance v0, Lorg/java_websocket/exceptions/InvalidHandshakeException;
|
||
|
|
||
|
const-string v1, "Handshake data rejected by client."
|
||
|
|
||
|
invoke-direct {v0, v1}, Lorg/java_websocket/exceptions/InvalidHandshakeException;-><init>(Ljava/lang/String;)V
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 628
|
||
|
:catch_1
|
||
|
move-exception v0
|
||
|
|
||
|
.line 629
|
||
|
iget-object v1, p0, Lorg/java_websocket/WebSocketImpl;->wsl:Lorg/java_websocket/WebSocketListener;
|
||
|
|
||
|
invoke-interface {v1, p0, v0}, Lorg/java_websocket/WebSocketListener;->onWebsocketError(Lorg/java_websocket/WebSocket;Ljava/lang/Exception;)V
|
||
|
|
||
|
.line 630
|
||
|
new-instance v1, Lorg/java_websocket/exceptions/InvalidHandshakeException;
|
||
|
|
||
|
new-instance v2, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v3, "rejected because of"
|
||
|
|
||
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-direct {v1, v0}, Lorg/java_websocket/exceptions/InvalidHandshakeException;-><init>(Ljava/lang/String;)V
|
||
|
|
||
|
throw v1
|
||
|
.end method
|
||
|
|
||
|
.method public toString()Ljava/lang/String;
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 708
|
||
|
invoke-super {p0}, Ljava/lang/Object;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|