Merge pull request #206 from socketio/package-name

Change package name
This commit is contained in:
Naoyuki Kanezawa
2015-08-31 21:20:13 +09:00
32 changed files with 93 additions and 89 deletions

View File

@@ -1,3 +1,8 @@
0.6.1 / 2015-08-31
==================
* change package name to "io.socket"
0.6.0 / 2015-08-09 0.6.0 / 2015-08-09
================== ==================

View File

@@ -1,15 +1,15 @@
# Socket.IO-client.java # Socket.IO-client Java
[![Build Status](https://travis-ci.org/nkzawa/socket.io-client.java.png?branch=master)](https://travis-ci.org/nkzawa/socket.io-client.java) [![Build Status](https://travis-ci.org/socketio/socket.io-client-java.png?branch=master)](https://travis-ci.org/socketio/socket.io-client-java)
This is the Socket.IO v1.x Client Library for Java, which is simply ported from the [JavaScript client](https://github.com/Automattic/socket.io-client). This is the Socket.IO v1.x Client Library for Java, which is simply ported from the [JavaScript client](https://github.com/socketio/socket.io-client).
See also: See also:
- [Android chat demo](https://github.com/nkzawa/socket.io-android-chat) - [Android chat demo](https://github.com/nkzawa/socket.io-android-chat)
- [engine.io-client.java](https://github.com/nkzawa/engine.io-client.java) - [engine.io-client-java](https://github.com/socketio/engine.io-client-java)
## Installation ## Installation
The latest artifact is available on Maven Central. You'll also need [dependencies](http://nkzawa.github.io/socket.io-client.java/dependencies.html) to install. The latest artifact is available on Maven Central. You'll also need [dependencies](http://socketio.github.io/socket.io-client-java/dependencies.html) to install.
### Maven ### Maven
Add the following dependency to your `pom.xml`. Add the following dependency to your `pom.xml`.
@@ -17,9 +17,9 @@ Add the following dependency to your `pom.xml`.
```xml ```xml
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.github.nkzawa</groupId> <groupId>io.socket</groupId>
<artifactId>socket.io-client</artifactId> <artifactId>socket.io-client</artifactId>
<version>0.6.0</version> <version>0.6.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
``` ```
@@ -28,11 +28,11 @@ Add the following dependency to your `pom.xml`.
Add it as a gradle dependency for Android Studio, in `build.gradle`: Add it as a gradle dependency for Android Studio, in `build.gradle`:
```groovy ```groovy
compile 'com.github.nkzawa:socket.io-client:0.6.0' compile 'io.socket:socket.io-client:0.6.1'
``` ```
## Usage ## Usage
Socket.IO-client.java has almost the same api and features with the original JS client. You use `IO#socket` to initialize `Socket`: Socket.IO-client Java has almost the same api and features with the original JS client. You use `IO#socket` to initialize `Socket`:
```java ```java
socket = IO.socket("http://localhost"); socket = IO.socket("http://localhost");
@@ -131,7 +131,7 @@ socket = IO.socket("https://localhost", opts);
See the Javadoc for more details. See the Javadoc for more details.
http://nkzawa.github.io/socket.io-client.java/apidocs/ http://socketio.github.io/socket.io-client-java/apidocs/
## Features ## Features
This library supports all of the features the JS client does, including events, options and upgrading transport. Android is fully supported. This library supports all of the features the JS client does, including events, options and upgrading transport. Android is fully supported.

16
pom.xml
View File

@@ -1,12 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.github.nkzawa</groupId> <groupId>io.socket</groupId>
<artifactId>socket.io-client</artifactId> <artifactId>socket.io-client</artifactId>
<version>0.6.1-SNAPSHOT</version> <version>0.6.2-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>socket.io-client</name> <name>socket.io-client</name>
<description>Socket.IO Client Library for Java</description> <description>Socket.IO Client Library for Java</description>
<url>https://github.com/nkzawa/socket.io-client.java</url> <url>https://github.com/socketio/socket.io-client-java</url>
<parent> <parent>
<groupId>org.sonatype.oss</groupId> <groupId>org.sonatype.oss</groupId>
@@ -27,9 +27,9 @@
</licenses> </licenses>
<scm> <scm>
<url>https://github.com/nkzawa/socket.io-client.java</url> <url>https://github.com/socketio/socket.io-client-java</url>
<connection>scm:git:git://github.com/nkzawa/socket.io-client.java.git</connection> <connection>scm:git:git://github.com/socketio/socket.io-client-java.git</connection>
<developerConnection>scm:git:git@github.com:nkzawa/socket.io-client.java.git</developerConnection> <developerConnection>scm:git:git@github.com:socketio/socket.io-client-java.git</developerConnection>
<tag>HEAD</tag> <tag>HEAD</tag>
</scm> </scm>
@@ -56,9 +56,9 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.github.nkzawa</groupId> <groupId>io.socket</groupId>
<artifactId>engine.io-client</artifactId> <artifactId>engine.io-client</artifactId>
<version>0.6.0</version> <version>0.6.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.json</groupId> <groupId>org.json</groupId>

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.backo; package io.socket.backo;
public class Backoff { public class Backoff {

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
/** /**
* Acknowledgement. * Acknowledgement.

View File

@@ -1,7 +1,7 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import com.github.nkzawa.socketio.parser.Parser; import io.socket.parser.Parser;
import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;

View File

@@ -1,10 +1,10 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import com.github.nkzawa.backo.Backoff; import io.socket.backo.Backoff;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import com.github.nkzawa.socketio.parser.Packet; import io.socket.parser.Packet;
import com.github.nkzawa.socketio.parser.Parser; import io.socket.parser.Parser;
import com.github.nkzawa.thread.EventThread; import io.socket.thread.EventThread;
import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
@@ -14,7 +14,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
/** /**
* Manager class represents a connection to a given Socket.IO server. * Manager class represents a connection to a given Socket.IO server.
*/ */
@@ -90,7 +89,7 @@ public class Manager extends Emitter {
private List<Packet> packetBuffer; private List<Packet> packetBuffer;
private Queue<On.Handle> subs; private Queue<On.Handle> subs;
private Options opts; private Options opts;
/*package*/ com.github.nkzawa.engineio.client.Socket engine; /*package*/ io.socket.engineio.client.Socket engine;
private Parser.Encoder encoder; private Parser.Encoder encoder;
private Parser.Decoder decoder; private Parser.Decoder decoder;
@@ -252,7 +251,7 @@ public class Manager extends Emitter {
logger.fine(String.format("opening %s", Manager.this.uri)); logger.fine(String.format("opening %s", Manager.this.uri));
Manager.this.engine = new Engine(Manager.this.uri, Manager.this.opts); Manager.this.engine = new Engine(Manager.this.uri, Manager.this.opts);
final com.github.nkzawa.engineio.client.Socket socket = Manager.this.engine; final io.socket.engineio.client.Socket socket = Manager.this.engine;
final Manager self = Manager.this; final Manager self = Manager.this;
Manager.this.readyState = ReadyState.OPENING; Manager.this.readyState = ReadyState.OPENING;
Manager.this.skipReconnect = false; Manager.this.skipReconnect = false;
@@ -338,7 +337,7 @@ public class Manager extends Emitter {
this.readyState = ReadyState.OPEN; this.readyState = ReadyState.OPEN;
this.emit(EVENT_OPEN); this.emit(EVENT_OPEN);
final com.github.nkzawa.engineio.client.Socket socket = this.engine; final io.socket.engineio.client.Socket socket = this.engine;
this.subs.add(On.on(socket, Engine.EVENT_DATA, new Listener() { this.subs.add(On.on(socket, Engine.EVENT_DATA, new Listener() {
@Override @Override
public void call(Object... objects) { public void call(Object... objects) {
@@ -558,14 +557,14 @@ public class Manager extends Emitter {
} }
private static class Engine extends com.github.nkzawa.engineio.client.Socket { private static class Engine extends io.socket.engineio.client.Socket {
Engine(URI uri, Options opts) { Engine(URI uri, Options opts) {
super(uri, opts); super(uri, opts);
} }
} }
public static class Options extends com.github.nkzawa.engineio.client.Socket.Options { public static class Options extends io.socket.engineio.client.Socket.Options {
public boolean reconnection = true; public boolean reconnection = true;
public int reconnectionAttempts; public int reconnectionAttempts;

View File

@@ -1,6 +1,6 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
public class On { public class On {

View File

@@ -1,10 +1,10 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import com.github.nkzawa.hasbinary.HasBinary; import io.socket.hasbinary.HasBinary;
import com.github.nkzawa.socketio.parser.Packet; import io.socket.parser.Packet;
import com.github.nkzawa.socketio.parser.Parser; import io.socket.parser.Parser;
import com.github.nkzawa.thread.EventThread; import io.socket.thread.EventThread;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
public class SocketIOException extends Exception { public class SocketIOException extends Exception {

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URI; import java.net.URI;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.hasbinary; package io.socket.hasbinary;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.socketio.parser; package io.socket.parser;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.socketio.parser; package io.socket.parser;
public class Packet<T> { public class Packet<T> {

View File

@@ -1,6 +1,6 @@
package com.github.nkzawa.socketio.parser; package io.socket.parser;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONTokener; import org.json.JSONTokener;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.backo; package io.socket.backo;
import org.junit.Test; import org.junit.Test;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;

View File

@@ -1,6 +1,6 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.junit.Test; import org.junit.Test;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -21,17 +21,17 @@ public class ExecutionTest extends Connection {
@Test(timeout = TIMEOUT) @Test(timeout = TIMEOUT)
public void execConnection() throws InterruptedException, IOException { public void execConnection() throws InterruptedException, IOException {
exec("com.github.nkzawa.socketio.client.executions.Connection"); exec("io.socket.client.executions.Connection");
} }
@Test(timeout = TIMEOUT) @Test(timeout = TIMEOUT)
public void execConnectionFailure() throws InterruptedException, IOException { public void execConnectionFailure() throws InterruptedException, IOException {
exec("com.github.nkzawa.socketio.client.executions.ConnectionFailure"); exec("io.socket.client.executions.ConnectionFailure");
} }
@Test(timeout = TIMEOUT) @Test(timeout = TIMEOUT)
public void execImmediateClose() throws InterruptedException, IOException { public void execImmediateClose() throws InterruptedException, IOException {
exec("com.github.nkzawa.socketio.client.executions.ImmediateClose"); exec("io.socket.client.executions.ImmediateClose");
} }
private void exec(String mainClass) throws InterruptedException, IOException { private void exec(String mainClass) throws InterruptedException, IOException {

View File

@@ -1,6 +1,6 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;

View File

@@ -1,9 +1,9 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import com.github.nkzawa.engineio.client.Transport; import io.socket.engineio.client.Transport;
import com.github.nkzawa.engineio.client.transports.Polling; import io.socket.engineio.client.transports.Polling;
import com.github.nkzawa.engineio.client.transports.WebSocket; import io.socket.engineio.client.transports.WebSocket;
import org.json.JSONObject; import org.json.JSONObject;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -195,7 +195,7 @@ public class ServerConnectionTest extends Connection {
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() { socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
@Override @Override
public void call(Object... args) { public void call(Object... args) {
socket.io().engine.on(com.github.nkzawa.engineio.client.Socket.EVENT_CLOSE, new Emitter.Listener() { socket.io().engine.on(io.socket.engineio.client.Socket.EVENT_CLOSE, new Emitter.Listener() {
@Override @Override
public void call(Object... objects) { public void call(Object... objects) {
values.offer("done"); values.offer("done");

View File

@@ -1,7 +1,7 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import com.github.nkzawa.util.Optional; import io.socket.util.Optional;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.socketio.client; package io.socket.client;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

View File

@@ -1,8 +1,8 @@
package com.github.nkzawa.socketio.client.executions; package io.socket.client.executions;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import com.github.nkzawa.socketio.client.IO; import io.socket.client.IO;
import com.github.nkzawa.socketio.client.Socket; import io.socket.client.Socket;
import java.net.URISyntaxException; import java.net.URISyntaxException;

View File

@@ -1,8 +1,8 @@
package com.github.nkzawa.socketio.client.executions; package io.socket.client.executions;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import com.github.nkzawa.socketio.client.IO; import io.socket.client.IO;
import com.github.nkzawa.socketio.client.Socket; import io.socket.client.Socket;
import java.net.URISyntaxException; import java.net.URISyntaxException;

View File

@@ -1,8 +1,8 @@
package com.github.nkzawa.socketio.client.executions; package io.socket.client.executions;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import com.github.nkzawa.socketio.client.IO; import io.socket.client.IO;
import com.github.nkzawa.socketio.client.Socket; import io.socket.client.Socket;
import java.net.URISyntaxException; import java.net.URISyntaxException;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.hasbinary; package io.socket.hasbinary;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;

View File

@@ -1,6 +1,6 @@
package com.github.nkzawa.socketio.parser; package io.socket.parser;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;

View File

@@ -1,6 +1,6 @@
package com.github.nkzawa.socketio.parser; package io.socket.parser;
import com.github.nkzawa.emitter.Emitter; import io.socket.emitter.Emitter;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.socketio.parser; package io.socket.parser;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;

View File

@@ -1,4 +1,4 @@
package com.github.nkzawa.util; package io.socket.util;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;