public class SocketClient extends Client
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
callLock |
protected java.nio.channels.SocketChannel |
channel |
static int |
FIRST_PORT |
static java.lang.String |
HOST |
static int |
LAST_PORT |
static java.lang.String |
TERMINATOR |
_password, _username, API_VERSION, DEFAULT_TIMEOUT, isVerbose, POLLS_INTERVAL, SOFTWARE_VENDOR_ID
Constructor and Description |
---|
SocketClient(java.lang.String username,
java.lang.String password) |
Modifier and Type | Method and Description |
---|---|
protected org.json.JSONObject |
call(java.lang.String cmd) |
protected org.json.JSONObject |
call(java.lang.String cmd,
org.json.JSONObject args) |
void |
close()
Closes opened connections (if any), cleans up resources.
|
boolean |
connect()
Opens API-specific connection if not opened yet.
|
void |
finalize() |
Captcha |
getCaptcha(int id)
Fetches an uploaded CAPTCHA details.
|
User |
getUser()
Fetches user details.
|
boolean |
report(int id)
Reports an incorrectly solved CAPTCHA
|
protected java.lang.String |
sendAndReceive(byte[] payload) |
Captcha |
upload(byte[] img) |
Captcha |
upload(byte[] img,
int type,
byte[] banner,
java.lang.String banner_text) |
Captcha |
upload(byte[] img,
java.lang.String challenge,
int type,
byte[] banner,
java.lang.String banner_text) |
Captcha |
upload(byte[] img,
java.lang.String challenge,
int type,
byte[] banner,
java.lang.String banner_text,
java.lang.String grid)
Uploads a CAPTCHA to the service.
|
decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, getBalance, getCaptcha, getCredentials, getText, getText, load, load, load, log, log, report, upload, upload, upload
public static final java.lang.String HOST
public static final int FIRST_PORT
public static final int LAST_PORT
public static final java.lang.String TERMINATOR
@Nullable protected java.nio.channels.SocketChannel channel
@NotNull protected java.lang.Object callLock
public SocketClient(java.lang.String username, java.lang.String password)
Client.Client(String, String)
@NotNull protected java.lang.String sendAndReceive(@NotNull byte[] payload) throws java.io.IOException
java.io.IOException
public void close()
Client
public boolean connect() throws java.io.IOException
Client
@Nullable protected org.json.JSONObject call(@NotNull java.lang.String cmd, @NotNull org.json.JSONObject args) throws java.io.IOException, Exception
java.io.IOException
Exception
@Nullable protected org.json.JSONObject call(@NotNull java.lang.String cmd) throws java.io.IOException, Exception
java.io.IOException
Exception
public void finalize()
finalize
in class java.lang.Object
@NotNull public User getUser() throws java.io.IOException, Exception
Client
@Nullable public Captcha upload(byte[] img, java.lang.String challenge, int type, @Nullable byte[] banner, java.lang.String banner_text, java.lang.String grid) throws java.io.IOException, Exception
Client
@Nullable public Captcha upload(byte[] img, java.lang.String challenge, int type, byte[] banner, java.lang.String banner_text) throws java.io.IOException, Exception
@NotNull public Captcha upload(byte[] img, int type, byte[] banner, java.lang.String banner_text) throws java.io.IOException, Exception
@NotNull public Captcha getCaptcha(int id) throws java.io.IOException, Exception
Client
getCaptcha
in class Client
id
- CAPTCHA IDjava.io.IOException
Exception