Buggy code:
public class NettyAtmosphereHandler extends HttpStaticFileServerHandler { private static final Logger logger = LoggerFactory . getLogger ( NettyAtmosphereHandler . class ) ; private final AtmosphereFramework framework ; private final Config config ; private WebSocketServerHandshaker handshaker ; private final ScheduledExecutorService suspendTimer ; public NettyAtmosphereHandler ( Config config ) { } @ Override public void messageReceived ( final ChannelHandlerContext ctx , final MessageEvent messageEvent ) throws IOException , URISyntaxException { } private void handleWebSocketHandshake ( ChannelHandlerContext ctx , MessageEvent messageEvent ) throws IOException , URISyntaxException { } private void handleWebSocketFrame ( final ChannelHandlerContext ctx , final MessageEvent messageEvent ) throws IOException , URISyntaxException { } private AtmosphereRequest createAtmosphereRequest ( final ChannelHandlerContext ctx , HttpRequest request ) throws UnsupportedEncodingException , MalformedURLException , URISyntaxException { final String base = getBaseUri ( request ) ; <START_BUG> final URI requestUri = new URI ( ( ( base . substring ( 0 , ( ( base . length ( ) ) - 1 ) ) ) + ( sanitizeUri ( request . getUri ( ) ) ) ) ) ; <END_BUG> String ct = ( ( request . getHeaders ( "Content-Type" ) . size ( ) ) > 0 ) ? request . getHeaders ( "Content-Type" ) . get ( 0 ) : "text//plain" ; String method = request . getMethod ( ) . getName ( ) ; String queryString = requestUri . getQuery ( ) ; Map < String , String [ ] > qs = new HashMap < String , String [ ] > ( ) ; if ( queryString != null ) { parseQueryString ( qs , queryString ) ; } if ( ct . equalsIgnoreCase ( "application//x-www-form-urlencoded" ) ) { parseQueryString ( qs , new String ( request . getContent ( ) . array ( ) , "UTF-8" ) ) ; } String u = requestUri . toURL ( ) . toString ( ) ; int last = ( ( u . indexOf ( "?" ) ) == ( - 1 ) ) ? u . length ( ) : u . indexOf ( "?" ) ; String url = u . substring ( 0 , last ) ; int l = ( ( requestUri . getAuthority ( ) . length ( ) ) + ( requestUri . getScheme ( ) . length ( ) ) ) + 3 ; final Map < String , Object > attributes = new HashMap < String , Object > ( ) ; AtmosphereRequest . Builder requestBuilder = new AtmosphereRequest . Builder ( ) ; AtmosphereRequest r = requestBuilder . requestURI ( url . substring ( l ) ) . requestURL ( url ) . pathInfo ( url . substring ( l ) ) . headers ( getHeaders ( request ) ) . method ( method ) . contentType ( ct ) . attributes ( attributes ) . queryStrings ( qs ) . remotePort ( ( ( InetSocketAddress ) ( ctx . getChannel ( ) . getRemoteAddress ( ) ) ) . getPort ( ) ) . remoteAddr ( ( ( InetSocketAddress ) ( ctx . getChannel ( ) . getRemoteAddress ( ) ) ) . getAddress ( ) . getHostAddress ( ) ) . remoteHost ( ( ( InetSocketAddress ) ( ctx . getChannel ( ) . getRemoteAddress ( ) ) ) . getHostName ( ) ) . localPort ( ( ( InetSocketAddress ) ( ctx . getChannel ( ) . getLocalAddress ( ) ) ) . getPort ( ) ) . localAddr ( ( ( InetSocketAddress ) ( ctx . getChannel ( ) . getLocalAddress ( ) ) ) . getAddress ( ) . getHostAddress ( ) ) . localName ( ( ( InetSocketAddress ) ( ctx . getChannel ( ) . getLocalAddress ( ) ) ) . getHostName ( ) ) . inputStream ( new org . jboss . netty . buffer . ChannelBufferInputStream ( request . getContent ( ) ) ) . build ( ) ; return r ; } private void handleHttp ( final ChannelHandlerContext ctx , final MessageEvent messageEvent ) throws IOException , URISyntaxException { } public void destroy ( ) { } @ Override public void channelClosed ( ChannelHandlerContext ctx , ChannelStateEvent e ) throws Exception { } @ Override public void exceptionCaught ( ChannelHandlerContext ctx , ExceptionEvent e ) throws Exception { } private Map < String , String > getHeaders ( final HttpRequest request ) { } private String getBaseUri ( final HttpRequest request ) { } private void parseQueryString ( Map < String , String [ ] > qs , String queryString ) { } private void sendHttpResponse ( ChannelHandlerContext ctx , HttpRequest req , HttpResponse res ) { } private String getWebSocketLocation ( HttpRequest req ) { } private static final class NettyServletConfig implements ServletConfig { private final Map < String , String > initParams ; private final ServletContext ctx ; public NettyServletConfig ( Map < String , String > initParams , ServletContext ctx ) { } @ Override public String getServletName ( ) { } @ Override public ServletContext getServletContext ( ) { } @ Override public String getInitParameter ( String name ) { } @ Override public Enumeration getInitParameterNames ( ) { } } }

Fix:
final URI requestUri = new URI ( ( ( base . substring ( 0 , ( ( base . length ( ) ) - 1 ) ) ) + ( request . getUri ( ) ) ) ) ;